- A Collection of Maximo Automation Script Examples
- Prevent completion / closure of work orders with open labor transactions
- Automatic Status Changes for Service Requests (SR) with Automation Script
- Import Classes and Packages using Javascript Language and Automation Scripts
- Automation Script: params variable not working with JavaScript language
- How to Rollup Cost with the Automation Script
- Disable Maximo business rule with an Automation Script
- Your first Automation Script in Maximo 7.5
Dominic (madd0g17 in our forum) has posted a great example of how he achieved this using an automation script. It is loosely based on this article. Here are the steps:
Thanks Dominic!!
Automation Script
LAUNCH POINT
Launch Point: WOLAUNCH
Object: WORKORDER
Object Event Condition: :status IN (SELECT value FROM synonymdomain WHERE domainid=’WOSTATUS’ AND maxvalue IN (‘COMP’,’CLOSE’))
Active: (checked)
Events: Add (checked), Update (checked)
SCRIPT
Script: WOOPENLT
Description: Prevent comp/close of WOs with open LT
Script Language: jython
Log Level: Error
VARIABLES
Variable: var_openlt
Description: input array variable to hold open labor transactions
Variable Type: IN
Binding Type: ATTRIBUTE
Launch Point Attribute: LABTRANS[finishdate IS NULL OR finishtime IS NULL].LABTRANSID* (Note: The asterisk at the end is important!)
Override?: (checked)
CODE
Source Code:
if var_openlt is not None and len(var_openlt) > 0:
errorgroup = ‘wo’
errorkey = ‘openltexists’
Then in Database Configuration, I created a message (from Select Action->Messages menu) like:
Message Group: wo
Message Key: openltexists
Display Method: MSGBOX
Message ID: BMXZZ0001E (Customer Customization)
Display ID: (checked)
Value: Work Order cannot be completed or closed while labor transactions are still open.
Just make sure your Automation Script is set to Active and you’re good to go! It even works via the mobile application we built so if a user tries to complete/close a work order in our app, it will respond with an error message instead.