Maximo

Maximo

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

 View Only
  • 1.  Issue with automation scripting

    Posted Tue November 19, 2024 07:38 AM

    This is a python script.

    In the workorder table I created a field called PAYBYCARD and it is defined in Maximo as a yes/no field

    When a workorder is saved, I need that field to be evaluated to see if it has been checked.  If it has been checked I need workorder to require 3 other fields to be filled out.

    Python script

    #PAIDBYPCARD SCRIPT

    if PAYBYPCARD == 1:

       PCARDAMOUMT=True

       PCARDHOLDER=True

       PCARDPAIDDATE=True

    When I activate the script and save a workorder with the box checked, it give me a java boolean evaluation error



    ------------------------------
    Paul Bishop
    ------------------------------


  • 2.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 10:11 AM

    Since paybypcard is a YORN attribute, the value to check will be True or False. You can either use if PAYBYPCARD: or if PAYBYPCARD == True:



    ------------------------------
    MANU MAGANTI
    EMA Canada| Inc.
    OAKVILLE
    ------------------------------



  • 3.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 10:28 AM

    I didn't see a way to respond to your message. Could you just try mbo.getBoolean("PAYBYPCARD") instead of the variable?



    ------------------------------
    MANU MAGANTI
    EMA Canada| Inc.
    OAKVILLE
    ------------------------------



  • 4.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 10:41 AM

    I got this error message when i tried to save anything



    ------------------------------
    Paul Bishop
    ------------------------------



  • 5.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 10:46 AM

    It should be True not TRUE.



    ------------------------------
    MANU MAGANTI
    EMA Canada| Inc.
    OAKVILLE
    ------------------------------



  • 6.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 11:20 AM

    ok, now it does not error, but it also does not require the fields to be filled in



    ------------------------------
    Paul Bishop
    ------------------------------



  • 7.  RE: Issue with automation scripting

    Posted Tue November 19, 2024 11:32 AM

    Review this link. You're missing _required on the variables.

    https://www.ibm.com/support/pages/automation-scripting-%E2%80%93-attribute-launch-point-%E2%80%93-setting-field-required



    ------------------------------
    MANU MAGANTI
    EMA Canada| Inc.
    OAKVILLE
    ------------------------------



  • 8.  RE: Issue with automation scripting

    Posted Wed November 20, 2024 02:12 AM

    Hi Paul,

    IMHO the logic you're trying to implement does not fit Object[SAVE] launch point but should rather be implemented in form of at least Attribute[ACTION] to set related attributes (non-)required depending on current PAYBYPCARD state, preferably complemented with Attribute[INIT] to do the same as Attribute[ACTION] but at the time of record init.

    When you do it on Object[SAVE] then this is already too late so what you eventually can get is actually to enforce data validation (you will not be able to save without required attr. values) but you will never get it reflected properly on the UI.



    ------------------------------
    Andrzej Więcław
    Maximo Technical Consultant
    AFRY
    Wrocław, Poland
    ------------------------------