Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
English
Technicaltopics
Evaluationsoftware
Community
Signin(orregister)
Events
SearchdeveloperWorks
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