Maximo Scripting – The mbo.add() method

This post is an excerpt from the Maximo 76 Scripting Features guide.

It’s a common thing to conditionally set some defaults when a new mbo gets added. We have so far leveraged the Object Launchpoint Init event to do that. We would need to check for onadd flag there to make sure we are adding a new mbo and then set the attribute values.

Another way to do that would be to create a script named .ADD. This will automatically add the script to the “add” callback right after the mbo add method execution has happened and right before the init() method gets called. You can use this script to now set default values conditionally. A sample script – ASSET.ADD shows how to default installdate attribute to current date only when the asset type is PUMP.

from psdi.server import MXServer 
if mbo.isNull("assettype") == False and mbo.getString("assettype") == "PUMP": 
    mbo.setValue("installdate", MXServer.getMXServer().getDate()) 

Maximo Scripting – The mbo.add() method

One thought on “Maximo Scripting – The mbo.add() method

  1. Hi,
    great guide. I would add that same goes for .SAVE script name
    For example, Script named ASSET.SAVE will trigger on every Asset save.

    Best regards,

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top