Technical Blog Post
Turning off a Maximo built-in business rule with scripting - an example from Work Order Tracking
Work Order Tracking location and asset business rule
In the Maximo product, the Work Order Tracking application is one of the most heavily used business applications. In the product release versions 5.x, 6.x and 7.x, right up to the most recent 7.5, a business rule is automatically applied that can be stated as follows: Populate the Asset field if the Location chosen for the work order contains just one asset.
With many clients the auto-population of the Asset field is not useful. Most work orders are opened against a Location, not an Asset. When the Asset field is so populated by the application, users must consciously clear out the entry before saving the work order record. An unwanted consequence of leaving the Asset reference on the work order record is to have costs accrue to the wrong entity.
"Turning off" the business rule
While there is a not an option to directly remove this business rule from the Work Order Tracking application, it can be effectively “turned off” by using Automation Scripting. A simple Attribute launchpoint and associated automation script can clear the value populated into the Asset field thereby eliminating the need for end users to manually clear the field.
The Attribute launchpoint and script are executed always after the standard business application field validation logic has been executed. The job of the script logic is to merely determine if the Asset field is empty or not and if not empty, to set it to null. In the implementation, the script logic applies to a work order record being newly inserted as well as an existing work order record being modified.
Clearing the Asset field has a downstream effect on other fields and business rules in the Work Order Tracking application. For example, a safety plan associated with the combination of asset and job plan will not get applied since the asset field has been cleared automatically. In this particular example, if a user subsequently enters the asset, then the safety plan business rule will kick in, as expected.
WOASSETCLR launch point and script
I provide a short summary of the launch point and script implementation.
- Define an Attribute launch point using the Automation Scripts application.
- Choose business object to be WORKORDER and attribute to be LOCATION.
- Define an INOUT variable v_assetnum and bind it to the ASSETNUM attribute of the WORKORDER object.
- Enter these lines of Jython code representing the script logic:
if v_assetnum is not None:
- Save the launch point and script; launch point is already active
Testing the launch point
If you have a product environment where you know a location is associated with a single asset, create a work order and select that location. When you tab out of the Location field, the Asset field will remain empty. The following screen captures illustrate the effect of the launch point and script.
Maximo 7.5 Work Order Tracking application with standard business rule (Asset field will be populated):
Automation Scripts are a enabling component of the Maximo product architecture to incorporate business rules. However, in many cases, to incorporate business rules in the product, knowledge of the business application behavior is needed (as in this example). While just two lines of script code were needed to implement the "turn off" business rule, a review of the implementation by a subject matter expert or experienced practitioner and testing in a development environment are hygiene items to be followed before rolling out the business rule to end users in a production environment.