Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Tue April 12, 2022 10:44 AM
    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


  • 2.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Tue April 12, 2022 11:06 AM
    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
    ------------------------------



  • 3.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Wed April 13, 2022 08:42 AM
    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
    ------------------------------



  • 4.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Thu April 14, 2022 03:57 PM
    Steve is correct, that functionality is not in 7.5.  What might work is a text field that would get filled in when wochangestatus.status is changed to CLOSE./COMP.  Placement of the text field as well as maybe something like making the message all caps would be key to the user noticing.  You could also do it as a condition that hides/shows text on the dialog so that the fields move...this might be better in alerting the user.

    ------------------------------
    Steve Hauptman
    ------------------------------



  • 5.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Thu April 14, 2022 04:16 PM
    Steven,

    I assume you mean the
    service.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 example
    var 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
    ------------------------------



  • 6.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Thu April 14, 2022 05:50 PM
    It's been so long that I might be overcomplicating what was done in the 7.6.0.0 release to make it possible. I thought there was more done to add support. It's worth having Matt try to see if it works.

    ------------------------------
    Steven Shull
    ------------------------------



  • 7.  RE: Script to Display Warning Message on WO Status Change if Actual Labor/Work Log are Missing

    Posted Tue May 10, 2022 12:09 AM
    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
    ------------------------------