Create Maximo automation script for inbound document transaction from external system.
--create script for integration
--select enterprise service
--select service name
--SYNC.NPP_DOCINFO.EXTEXIT.IN
from com.ibm.tivoli.maximo.util.mbo import IterableMboSet
from java.math import BigDecimal
from java.io import File
from java.rmi import RemoteException
from psdi.mbo import *
from psdi.util import MXException
from psdi.app.doclink import Docinfo
from psdi.app.doclink import DocinfoSet
from psdi.app.doclink import DocinfoSetRemote
from psdi.app.doclink import DoclinksSetRemote
from java.lang import SecurityException
import sys
erData.breakData()
docinfoid = erData.getCurrentData("DOCINFOID")
dociset = MXServer.getMXServer().getMboSet("DOCINFO",MXServer.getMXServer().getUserInfo('MAXADMIN'))
dociset.setWhere("docinfoid="+str(docinfoid))
dociset.reset()
contentuid = dociset.moveFirst().getString("CONTENTUID")
erData.setCurrentData("CONTENTUID",contentuid)
# Code to delete the file from server
URLTYPE = dociset.moveFirst().getString("URLTYPE");
if (URLTYPE=='FILE'):
URLNAME = dociset.moveFirst().getString("URLNAME");
print('**** deletefilefromserver... ')
deletefile = File(URLNAME)
if (deletefile.exists()):
print('**** Deleting file... '+URLNAME)
deletefile.delete()
print('**** File Deleted... '+URLNAME)
--create script for integration
--select enterprise service
--select service name
--SYNC.NPP_DOCINFO.EXTEXIT.IN
from com.ibm.tivoli.maximo.util.mbo import IterableMboSet
from java.math import BigDecimal
from java.io import File
from java.rmi import RemoteException
from psdi.mbo import *
from psdi.util import MXException
from psdi.app.doclink import Docinfo
from psdi.app.doclink import DocinfoSet
from psdi.app.doclink import DocinfoSetRemote
from psdi.app.doclink import DoclinksSetRemote
from java.lang import SecurityException
import sys
erData.breakData()
docinfoid = erData.getCurrentData("DOCINFOID")
dociset = MXServer.getMXServer().getMboSet("DOCINFO",MXServer.getMXServer().getUserInfo('MAXADMIN'))
dociset.setWhere("docinfoid="+str(docinfoid))
dociset.reset()
contentuid = dociset.moveFirst().getString("CONTENTUID")
erData.setCurrentData("CONTENTUID",contentuid)
# Code to delete the file from server
URLTYPE = dociset.moveFirst().getString("URLTYPE");
if (URLTYPE=='FILE'):
URLNAME = dociset.moveFirst().getString("URLNAME");
print('**** deletefilefromserver... ')
deletefile = File(URLNAME)
if (deletefile.exists()):
print('**** Deleting file... '+URLNAME)
deletefile.delete()
print('**** File Deleted... '+URLNAME)
No comments:
Post a Comment