Maximo Scripting – Controlling Mbo duplicate

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

Say we want to hold the reference of work order from which we created (copied from) a new work order. We would create a custom attribute called “copiedfrom” in the WORKORDER object. We would then need to customize the duplicate process of the Workorder to store the “wonum” of the original workorder in the “copiedfrom” attribute of the newly duplicated mbo. To do this, we will create a vanilla script with the name .DUPLICATE. For example in this case we will name it WORKORDER.DUPLICATE to intercept the duplicate event. The name .DUPLICATE will intercept the duplicate event for the mbo named. We will have 2 implicit variables – mbo and dupmbo to leverage in this script. The mbo variable will point to the original mbo and the dupmbo will point to the newly duplicated mbo. We can now set the “copiedfrom” attribute using the script code below.

dupmbo.setValue("copiedfrom", mbo.getString("wonum"))

This script is called after all duplicate logic is executed in the Mbo framework. Effectively you can write logic in this script using both the mbo and dupmbo to control what gets duplicated as well as do some post duplicate actions (like the sample above).

Maximo Scripting – Controlling Mbo duplicate

Leave a Reply

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

Scroll to top