0% found this document useful (0 votes)
655 views5 pages

Deleting DOCLINKS With Automation Scripting (Asset Management)

This document discusses a Python script that allows for the deletion of attached documents (DOCLINKS) in Maximo through automation. The script leverages escalations and automation scripting in Maximo to purge documents from the server when a defined criteria is met. The script deletes the file from the server location and cleans up related entries in tables like Doclinks and CommLogDocs. Instructions are provided on setting up an automation script and escalation to invoke the script on a scheduled basis.

Uploaded by

soo7cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
655 views5 pages

Deleting DOCLINKS With Automation Scripting (Asset Management)

This document discusses a Python script that allows for the deletion of attached documents (DOCLINKS) in Maximo through automation. The script leverages escalations and automation scripting in Maximo to purge documents from the server when a defined criteria is met. The script deletes the file from the server location and cleans up related entries in tables like Doclinks and CommLogDocs. Instructions are provided on setting up an automation script and escalation to invoke the script on a scheduled basis.

Uploaded by

soo7cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

IBM

English

Technicaltopics

Evaluationsoftware

Community

Signin(orregister)

Events

SearchdeveloperWorks

Myhome Forums Blogs Communities Profiles Podcasts Wikis Activities IBMChampionprogram

ThisBlog

MyBlogs

PublicBlogs

Search

MyUpdates

anywhere

apps

escalation installationmanag
maximo+7.6 maximo7.6

mobile mobility
Login
toparticipate

Aboutthisblog
WelcometotheAsset

DeletingDOCLINKSwithAutomationScripting
SachBalagopalan | Dec22 | Visits(186)

ManagementBlog,whereyou
canreadtheperspectivesfrom

AssetManagementexperts.This
Blogprovidestechnicalinsightsintothe

Contributors:SteveHauptman,TedLyons,MikeSielian,JohnCook,MelodyBienfang

Introduction

Maximoproductsolutions.

0
Like

Share
Tweet

Thispostdescribesatechnicalsolutionthatgivesclientstheflexibilitytodeleteattached
documents(DOCLINKS)seamlesslyandwithease.ByleveragingexistingfunctionalityinMaximonamelyEscalations

Relatedposts

andAutomationScripting,youcanpurgeattacheddocumentsfromthelocationwherethedocumentphysicallylives.A
selectioncriteriashouldbedefinedinanEscalation(e.g.STATUS='CLOSED')alongwithanActionwhichinvokesa

InstallingMaximo7....
UpdatedDec22 1 0

Pythonscript(describedinthispost)thatwillphysicallydeletethedocumentfromtheserver.

ThePythonscriptprovidedinthispostisgenericandcanbeappliedtoanyobject(Workorder,Incident,SRetc).Although

Configuringappsfor...
UpdatedDec19 0 0

werecommendthisscriptbeusedwithanEscalationandanActionlaunchpoint,itcanbeusedwithotherlaunchpoints
aswell.InadditiontodeletingthedocumentfromtheserverthescriptwillalsocleanuptheentriesintheDoclinksand
otherrelatedtables.Therewillbeno"orphaned"recordslingeringafterthefileisphysicallydeleted.Thescriptaddresses
directattachmentsaswellasattachmentsuploadedviaCommunicationTemplatesandCommLog.

Disclaimer

Finallybeforewegetintothedetailspleasenotethatthissolutionshouldnotbedeployeddirectlyintoaproduction
environmentbeforetestingandmakingsureitfitstheclient'susecase.Thescriptdoesnotcontainanybusinessrulesor
anysortofvalidation.ItsimplydeletesthefileandcleanstheDoclinktable.Itisuptotheclienttodecidewhentoinvoke
thescriptbydefiningtheappropriateescalationcriteriaandfrequency.

PythonCode
frompsdi.common.actionimportActionCustomClass

InstallingMaximo7....
UpdatedDec22

InstallingMaximo7....
UpdatedDec22 1 0
PowerAdmPythonTo...
UpdatedDec15 0 0

Links
Manuallyinstallandconfigure...

Recenttweets

fromjava.ioimportFile
fromjava.rmiimportRemoteException
frompsdi.mboimport*
frompsdi.mboimportMboConstants
frompsdi.utilimportMXException
frompsdi.app.doclinkimportDocinfo
frompsdi.app.doclinkimportDocinfoSet
frompsdi.app.doclinkimportDocinfoSetRemote
frompsdi.app.doclinkimportDoclinksSetRemote
fromjava.langimportSecurityException
frompsdi.serverimportMXServer
importsys

Follow@ServMgmtConnect

#COMMENT:functiontocheckifthedoclinkownerisacommlogorthemainmbo.
defisCommLogOwner(doclink):

ownertable=doclink.getString("OWNERTABLE")

print('****OWNERTABLE...'+ownertable)

if(ownertable)=="COMMLOG":

returnFalse

returnTrue

#COMMENT:functiontodeletethecommlogdocphysicalfilefromtheserver.
defdeletecommlogfilefromserver(docinfo):

docinfoid=docinfo.getString("DOCINFOID")

commlogdocsSet=MXServer.getMXServer().getMboSet("COMMLOGDOCS",docinfo.getUserInfo())

commlogdocsSet.setWhere("DOCINFOID='"+docinfoid+"'")

commlogdocsSet.reset()

print('****DOCINFOID...'+docinfoid)

k=0

commlogdoc=commlogdocsSet.getMbo(k)

while(commlogdocisnotNone):

urlname=commlogdoc.getString("URLNAME")

deleteCfile=File(urlname)

if(deleteCfile.exists()):

k=k+1

commlogdoc.delete(MboConstants.NOACCESSCHECK)

commlogdoc=commlogdocsSet.getMbo(k);

#commlogdocsSet.deleteAll(MboConstants.NOACCESSCHECK)

commlogdocsSet.save(MboConstants.NOACCESSCHECK)

deleteCfile.delete();

#COMMENT:functiontodeletethephysicalfilefromtheserver.
defdeletefilefromserver(docinfo):

urlname=docinfo.getString("URLNAME")

deletefile=File(urlname)

if(deletefile.exists()):

print('****Deletingfile...'+urlname)

deletefile.delete()

print('****FileDeleted...'+urlname)

print'Startingdoclinkdelete.....'
#COMMENT:fromtheActionMBOgettheassociatedDoclinksSetbasedonthe'DOCLINKS'relationship.
doclinksSet=mbo.getMboSet("DOCLINKS")
ifdoclinksSetisnotNone:

i=0

doclink=doclinksSet.getMbo(i)

while(doclink!=None):

docinfoSet=doclink.getMboSet("DOCINFO")

if(docinfoSetisnotNone):

j=0

docinfo=docinfoSet.getMbo(j)

while(docinfo!=None):

if(isCommLogOwner(doclink)):

else:

print('****deletefilefromserver...')

deletefilefromserver(docinfo)

docinfo.delete(MboConstants.NOACCESSCHECK)

doclink.delete(MboConstants.NOACCESSCHECK)

j=j+1

docinfo=docinfoSet.getMbo(j);

i=i+1

doclink=doclinksSet.getMbo(i);

deletecommlogfilefromserver(docinfo)

DefiningtheAutomationScriptintheAutomationScriptsApplication

LaunchtheAutomationScriptAppand....

1)Select"ScriptwithActionLaunchPoint"you'regoingtobelaunchingthisscriptfromanAction.

2)GiveitanamelikeDOCLINKSorsomethingandnoteitdownbecauseyou'llneeditwhendefiningtheActioninthe
nextstep.IusedWorkorderbutyoucansettheObjecttowhateverisapplicable.

3)Setthefieldsasdefinedintheimagebelow.

4)Cutandpastethepythoncodefromthe"Code"sectioninblueabove

DefineanActionintheActionsApplication
GototheActionsappandcreateanewactionlikethis...
TheParameter/AttributehastothebethesamenameastheScriptnamecreatedinthestepabove.

DefinetheEscalation
GototheEscalationApplicationanddefineanEscalationwiththeappropriateconditionandreferencepointsthatfityour
usecase.Hereisalinkonhowtosetupanescalation

Conclusion
ThisisaprettypowerfulsolutionforthoseseekingtodeleteDOCLINKattachmentswithinMaximo.Thereisnoneedto
deployanycompiledcodeorbringdowntheservertotakeadvantageofthissolution.

Tags:scriptingattacheddocsescalationpythonattacheddocsmaximotpaedoclinks

AddaComment

MoreActions
AddaComment MoreActions

Comments(0)
PreviousEntry

Main

NextEntry

About

Feeds

Reportabuse

Faculty

Help

Newsletters

Termsofuse

Students
BusinessPartners

Contactus

Follow

Thirdpartynotice

Submitcontent

Like

IBMprivacy
IBMaccessibility

You might also like