from psdi.server import MXServerfrom psdi.util.logging import MXLoggerFactorylog = MXLoggerFactory.getLogger("maximo.script.aqautoscript")mxserver = MXServer.getMXServer()userInfo = mxserver.getSystemUserInfo()# arg = crontask scriptarg parameterif instanceName and scriptName and arg:AssetSet = mxserver.getMboSet("ASSET", mxserver.getSystemUserInfo())AssetSet.setWhere("ASSETNUM = '" + arg + "' ")AssetSet.reset()asset = AssetSet.getMbo(0)if asset:asset.setValue("description",arg)AssetSet.save()log.info('\n instanceName is: ' + instanceName )log.info('\n ARG is: ' + arg)log.info('\n Automation Script name: ' + scriptName)
Step 2. Create a New Cron as below. and enter the name of the script into the parameter of Script Name.
Name: anyName, CRONAUTOMATION
Class:com.ibm.tivoli.maximo.script.ScriptCrontask
Cron Task Instances: CRONTASKINSTANCE
Parameters:
SCRIPTARG: (Any argument you want to pass to the script, and the script will get this by "arg" implicit variable.)
SCRIPTNAME: CRONAUTOMATIONSCRIPT (we created in step 1.)
Note: If you create a comma-delimited list of values that you want to pass to the Automation Script in the SCRIPTARG parameter, you can access them in the script with something like:
if arg: srOwner,wfProcess = arg.split(",")
No comments:
Post a Comment