Thanks Jason for this and your previous response. This is helpful information and I will likely find great use of it in the future.
For this scenario, turns out we do still want to maintain the message simply as a Warning (reminder) and proceed with the status change still. Users can then optionally add missing Labor/Work Logs as needed to the WO in that COMP status, as I feel the Yes/No/Cancel dialog may impact our WO completion rates.
I was able to get my previous attempt working on the Labor/Work Log check. Below is the Warning being shown, which appears to piggy back in the same dialog along with the Status Change being successful. I think this is the best case. I tested on several WO's in different scenarios and appears to be functioning as expected. For example:
- WO with Actual Labor and Log - no warning
- WO with Actual Labor but no Log - warning
- WO w/o Actual Labor but Log - warning
- WO w/o Actual Labor and Log - warning

Below is what I've done. Would you recommend any changes or another method?
1) Create message in Database Configuration
2) Create Automation Script with Object Launch Point
- Object: WORKORDER
- Object Event Condition: :status IN (SELECT value FROM synonymdomain WHERE domainid='WOSTATUS' AND maxvalue IN ('COMP','CLOSE'))
- Variables:

- Script Code:
if vLT is None:
warngroup = 'workorder'
warnkey = 'missingLabLog'
if vWL is None:
warngroup = 'workorder'
warnkey = 'missingLabLog'
Cheers,
Matt
------------------------------
Matt F
------------------------------
Original Message:
Sent: Thu April 14, 2022 04:15 PM
From: Jason VenHuizen
Subject: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing
Steven,
I assume you mean theservice.yncerror();
wasn't added in Maximo 7.5.
Looking at the JavaDocs for 7.5 there is the MXApplicationYesNoCancelException so you should be able just manually throw that instead.
So using our blog post as a starting point you can do the following.
importClass(psdi.util.MXApplicationYesNoCancelException);// add these for the switch statements, release service.YNC_NULL with just YNC_NULL for examplevar YNC_NULL = -1;var YNC_YES = 8;var YNC_NO = 16;var YNC_OK = 2;var YNC_CANCEL = 4;// replace// service.yncerror('sharptree', 'yncexample');// with throw new MXApplicationYesNoCancelException("YOUR_SCIPRTNAME.YOURLAUNCHPOINT_NAME.HERE", "messageGroup", "messageKey")
Since all the implicit service class is doing is making it nicer to access these things, you can still manually implement it.
Hope that helps and Steven tell me if I am wrong about that.
------------------------------
Jason VenHuizen
https://sharptree.io
https://opqo.io
Original Message:
Sent: Wed April 13, 2022 08:41 AM
From: Steven Shull
Subject: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing
Jason's advice is spot on as always. Unfortunately, we didn't add that functionality until 7.6.0.0 so it won't be available in your version. I'm not aware of a way to accomplish it on your version without writing a java customization.
------------------------------
Steven Shull
Original Message:
Sent: Tue April 12, 2022 11:06 AM
From: Jason VenHuizen
Subject: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing
Hi Matt,
I don't have access to a 7.5 environment so there may be some slight variations given that it is an older instance.
What you probably want to use is a YesNoCancelException to prompt the user to see if they want to continue. On save for the object you can check if the mbo.getMboSet("SHOWACTUALLABOR").isEmpty() to check if the labor has been added, then throw the error prompting the user if it is empty (there are no records).
I wrote a post about it in detail here https://www.sharptree.io/blog/2022/2022-01-24-yes-no-cancel/
If you have any questions feel free to reach out.
------------------------------
Jason VenHuizen
https://sharptree.io
https://opqo.io
Original Message:
Sent: Tue April 12, 2022 10:43 AM
From: Matt F
Subject: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing
Hi Folks,
Working in Maximo 7.5.0.6.
I have a business request to fulfil in which I'm running into a few hiccups implementing. They would like Maximo to display a Warning Message when completing a WO (ie. status of COMP or CLOSE) if there are no Actual Labor or no Work Log records present. They still want to be able to proceed through the message to either then edit/update the work order (ie. Add labour/log accordingly), or continue the WO closure/completion process and leave them blank.
I have tried using an Object Launch Point on WORKORDER, with the following Object Event Condition:
:status IN (SELECT value FROM synonymdomain WHERE domainid='WOSTATUS' AND maxvalue IN ('COMP','CLOSE'))
I have added two variables (one to check labtrans, one to check worklog).
Lastly, the script simply just checks if the variable is None, and then throws the warning.
In the case of using both variables, I received an error on the Work Log. When using only the LABTRANS variable, it displayed the Warning but did not prevent the Status Change.
Thanks in advance for any guidance and assistance on this.
Cheers,
Matt
------------------------------
Matt F
------------------------------
#Maximo
#AssetandFacilitiesManagement