There are two approaches when dealing with Maximo automation scripts input and output variables.
- Using launch point variables – This method is described in the product’s knowledge center and allows to get/set values from/to the database specifying how to bind the script variables to specific database fields.
- Using getter/setter methods – This approach uses Maximo MBO application layer (businessobjects) methods to get and set values. These methods are described in my Maximo Automation Scripts Quick Reference document.
Launch point variables are also called ‘bound variables’ here is how they look like.
I hate launch point variables!
- Code is less easy to read – It is almost impossible to fully understand the logic implemented in the script by simply reading the script code. This may be mitigated using some smart naming convention in the code but to me it will always be less intuitive.
- Less control over read/write variables – Launch point variables allows to define INOUT variables. This will make the script even less clear and reliable.
- Mixed style – At the end you will always be using mbo.getString method (or similar ones) in your code inside loops or to fetch data from related tables so this will end up with mixed use of bound and unbound variables which is really annoying.
- Less powerful – By learning to use Maximo Java APIs you will have more control and you can write more reliable code. Using bound variables creates unnecessary layer between you and Maximo just to avoid writing two or three lines of code.
Let’s see an example. In this IBM post a tutorial explains to set the Work Order’s description from the Service Request’s description when the Work Order is created from a Service Request. This example script is this:
owner = mbo.getOwner() if owner is not None: desc = owner.getString("description")
What is ‘desc’ in this code? Is it bound to a database field? Which one?
Why not simply writing the script like this and avoid defining the bounded variable?
owner = mbo.getOwner() if owner is not None: mbo.setValue("description", owner.getString("description"))
My suggestion is to never use bound variables and always use Mbo getter/setter methods to read and write data.