Maximo

Maximo

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

 View Only
Expand all | Collapse all

Working Example - Allow Object Creation and Allow Object Deletion in Automation Script

  • 1.  Working Example - Allow Object Creation and Allow Object Deletion in Automation Script

    Posted Sat October 17, 2020 06:46 AM
    Hi All,
    I'm just trying to understand what kind of functionality would work in Allow Object Creation/Allow Object Deletion event in Object Launch point. If anyone has a working example , kindly share.

    ------------------------------
    MAX092012
    ------------------------------

    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Working Example - Allow Object Creation and Allow Object Deletion in Automation Script

    Posted Mon October 19, 2020 03:16 AM
    MAX092012

    These events are equivalent to  canAdd() and canDelete() methods from Mbo framework and you can do validation for records addition is allowed  , record deletion is allowed based on required business rules using this events.

    ------------------------------
    Prashant Bavane
    ------------------------------



  • 3.  RE: Working Example - Allow Object Creation and Allow Object Deletion in Automation Script

    Posted Mon October 19, 2020 08:30 AM
    Adding on a bit more to Prashant's response, take WO as an example. When its status is APPR, by default you can no longer add in planned materials. Conversely, while it's WAPPR you can't add in actual labor. The canAdd/canDelete event fires immediately prior to the framework trying to create the MBO record which makes it a more efficient place to check whether or not that action should be allowed. You could wait until the user tries to save and throw an error, but that would be a poor user experience. 

    Allow Object Deletion is pretty straight forward and similar to any other script. If you throw an error, using service.error("messageGroup","messageKey") for example, Maximo won't allow it to be deleted.

    Allow Object Creation is a little bit different as there is no implicit mbo variable. This is because you're trying to determine if a record can be added, thus it doesn't exist yet. So instead of mbo as an implicit variable, you have mboset to reference the set the record would be added to (IE LABTRANS, POLINE, etc.). You then again throw an error when you don't want them to create the record.

    In both cases, you often look at the owner record (IE the WORKORDER or PO header). You get the owner mbo using mbo.getOwner() for allow object deletion and mboset.getOwner() for allow object creation.

    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------