A non-technical person should be able to read and modify scripts in Maximo - that’s the goal to keep in mind when writing complex configurations. At the same time simple copy-paste coding which happens a lot in case of modifications creates technical debt and can lead to unexpected results in production.
So how to cope with it? Let's dive in.
When you check 'Allow invoking Script functions' you can define methods in one library script and call them across automation scripts. This would be your one source of truth, nod duplicates anymore.
Example:
def yourMethodName(param1,param2):
smthtoreturn = False
try:
# your code
smthtoreturn = True
except:
# your exception
return smthtoreturn
In order to call this method from other scripts:
smthtoreturn = service.invokeScript("UTILSCRIPT", "yourMethodName", [param1, param2])
But here comes the real secret: library scripts reduce technical debt and make your Maximo environment easier to support long-term only if they’re transparent and well-documented!! Otherwise, they’re just another black box.
Remember in my previous post I was talking about smart logging practices for Maximo? Your library script is a place where you need to use comments to clarify what the method does, where it’s used, why it exists, when it runs and what the outcome or possible errors will be.
And please don't use library scripts if your team doesn’t have a process for versioning and documentation of scripts or/and it adds complexity without clear business value.
Need advice for an expert? Book an appotiment now! info@annacode.nl
