1

I have a WO in Maximo 7.6.1.1.

When a user updates the Service Address, I want to invoke an autoscript that has an Object Launch Point on the WORKORDER object.

enter image description here


enter image description here


Is there a way to invoke an autoscript (that has an object launch point on the WORKORDER object) when the Service Address is updated?

User1974
  • 276
  • 1
  • 17
  • 63
  • Is this question about reusing an existing automation script when triggered, or about running on/using the work order object when triggered? – Dex Jan 30 '20 at 01:59
  • @Dex: The former, although I'll admit that I haven't fully grasped this subject yet. – User1974 Jan 30 '20 at 04:58

4 Answers4

2

You should see if mbo.getOwner() returns something and if that something.getName() is WORKORDER and, further, the work order you are expecting it to be. Subject to all that, you can invoke that other autoscript with code like this:

from java.util import HashMap
lpVars = HashMap()
lpVars.put("mbo",mbo.getOwner())
#repeat the last line for any other implicit/explicit variables your target
#script is going to use / expect to be defined
service.invokeScript("YOURSCRIPTNAME", lpVars)
someVar = lpVars.get("someVarDefinedInYOURSCRIPTNAMEWhenItEnded")

Note the work with the lpVars variable. I use it to store the "implicit"/"explicit" variables (e.g. "mbo") that the script I'm calling will expect to be defined. Basically, I'm doing the setup a launch point normally does, since my code is the launch point. Then, since I'm the launch point, I have access to whatever variables were defined when the script ended by Maximo adding them to / updating them in lpVars.

Preacher
  • 2,127
  • 1
  • 11
  • 25
2

You can create reusable "library" scripts that you can call directly as Preacher explained. See IBM example here: https://www.ibm.com/support/knowledgecenter/SSFGJ4_7.6.0/com.ibm.mbs.doc/autoscript/c_example_reuse.html

So you could have your WO object launchpoint call the library script and your SA object launchpoint calling the same. You then just need to make change to one script if needed and that's great.

JPTremblay
  • 900
  • 5
  • 8
1

I don't believe you can. An object launch point is all about telling Maximo which object to monitor for the following event(s), not exactly about which object to launch the script on (though, for various reasons, those two are necessarily tied together).

What you can do, though, is put your launch point on the service address as you really do want, but then in your script fetch the on-screen/in-memory work order that you want to do something with and do that. This is done through the getOwner() method call or the special ":owner" (maybe with the ampersands, I can't remember) relationship reference.

Dex
  • 1,241
  • 6
  • 13
0

This is the solution I came up with:

mboName=mbo.getName()

if mboName == 'WOSERVICEADDRESS':
  mboWO = mbo.getOwner()
elif mboName == 'WORKORDER':
  mboWO=mbo

sax = mboWO.getDouble("SERVICEADDRESS.LONGITUDEX")
say = mboWO.getDouble("SERVICEADDRESS.LATITUDEY")

if sax and say:
    mboWO.setValue("longitudex", sax)
    mboWO.setValue("latitudey", say)

elif mboWO.getString("ASSETNUM") and mboWO.getBoolean("ASSET.PLUSSISGIS") == 1:
    mboWO.setValue("longitudex", mboWO.getDouble("ASSET.longitudex"))
    mboWO.setValue("latitudey", mboWO.getDouble("ASSET.latitudey"))

elif mboWO.getString("LOCATION") and mboWO.getBoolean("LOCATION.PLUSSISGIS") == 1:
    mboWO.setValue("longitudex", mboWO.getDouble("LOCATION.longitudex"))
    mboWO.setValue("latitudey", mboWO.getDouble("LOCATION.latitudey"))
else:
    mboWO.setValue("longitudex", None)
    mboWO.setValue("latitudey", None)

The script has launch points on multiple objects:

enter image description here

User1974
  • 276
  • 1
  • 17
  • 63