Maximo Open Forum

 View Only
  • 1.  Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 08-02-2024 12:41

    Hello More Maximo Community,

    Is it possible to limit a work type to only be available based upon the classification (or classstrucureid) of an asset?

    Is this possible natively within Maximo, or would it be possible with an automation script?

    Thank you in advance,


    #Administration
    #Assets
    #WorkManagement

    ------------------------------
    Danny Richardson
    Maximo Administrator Manager
    Technimark LLC
    ------------------------------


  • 2.  RE: Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 08-08-2024 15:37

    I could do it with TRM Rules and I think it could be done with CEM.  Depending on how complicated your rules are you might have to create the mapping in a ALNDomain so that you can change the rules later by just changing the values.

    You will need to look at both a new blank work order as well as from PMs.  Ideally you would just limit the value lists but there is one thing that CEM has trouble with and that is changing existing data.  I can't think of anything other than an automation script or TRM Rules that could on Save look to see if the rule was violated and stop the save from happening.  You will need to account for a user not adding a classification, setting the work type and then adding the classification in violation of your rules.



    ------------------------------
    Brad Delong
    WDW
    ------------------------------



  • 3.  RE: Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 27 days ago

    Hi @Danny Richardson!

    I tried to make scripts but they never worked... the java class FldWorkType.class always prevails and takes control. I was unable to restrict the worktype based on the classstructureid of the WO's assets . I imagine that if it is not possible (maybe someone can help you with a script) via script, it would be necessary to modify the java class. 

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A. - Actively seeking employment
    ------------------------------



  • 4.  RE: Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 24 days ago
    Edited by Matt F 24 days ago

    Hi @Martin Fabra, which types did you try? I went with a Retrieve List as a test. In this case, I've hardcoded mappings between CLASSSTRUCTUREID and the WORKTYPE in my script. If there's no Asset, it'll show them all. It's late but I know there's another way to potentially grab these dynamically, or so my mind is telling me. Tagging a few others... @Steven Shull @Jade Warren @Tim Ferrill

    Either way, I was able to get my desired results with the following Retrieve List Attribute Launch Point (WORKORDER.WORKTYPE) Script. There's definitely some additional testing required that I did not perform, but thought this might be a helpful start.

    from psdi.mbo import MboConstants
    
    # Initialize listMboSet to handle scenarios where asset is None
    listMboSet = None
    
    # Ensure mbo is valid before performing any operations
    if mbo is not None and mbo.isBasedOn("WORKORDER"):
    
        # Define the mapping between CLASSSTRUCTUREID and WORKTYPE
        mapping = {
            "1128": ["CM", "EM"],
          #  "CLASSID2": ["WORKTYPE", "WORKTYPE"],
            #"CLASSID3": ["WORKTYPE", "WORKTYPE"],
            # Add more mappings as needed
        }
    
        # Get the asset's CLASSSTRUCTUREID only if the asset is not None
        asset = mbo.getMboSet("ASSET").getMbo(0)
        if asset is not None:
            classstructureid = asset.getString("CLASSSTRUCTUREID")
    
            # Get the list of allowed worktypes for this classstructureid
            allowed_worktypes = mapping.get(classstructureid, [])
    
            # Create a new MboSet to store the filtered WORKTYPEs
            worktypeSet = mbo.getMboSet("$WORKTYPE_LOOKUP", "WORKTYPE", "")
            worktypeSet.clear()  
    
            # Iterate over the allowed worktypes and add them to the MboSet
            for worktype in allowed_worktypes:
                worktypeMbo = worktypeSet.addAtEnd()
                worktypeMbo.setValue("WORKTYPE", worktype, MboConstants.NOACCESSCHECK)
    
            # Set the filtered worktype set for the lookup
            listMboSet = worktypeSet
        else:
            # Handle scenario where asset is None
            listMboSet = mbo.getMboSet("$WORKTYPE_LOOKUP", "WORKTYPE", "1=1")
    
    # The script should return the MboSetRemote object directly for the Retrieve List event
    if listMboSet is None:
        listMboSet = mbo.getMboSet("$WORKTYPE_LOOKUP", "WORKTYPE", "1=1")
    
    listMboSet



    ------------------------------
    Matt F
    ------------------------------



  • 5.  RE: Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 24 days ago

    Hey guys,

    This looks like a pretty solid solution. Another potential option is to use Data Restrictions and a Conditional Expression based on an Automation Script, but I'd probably prefer the Retrieve List path, as Data Restrictions can result in some unintended/unpredictable behavior in my experience.



    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 6.  RE: Limit Work Types to Specific Classifications or Classstrucureid?

    Posted 24 days ago

    Hi Matt! 

    I replicated your script in my Demo 7.6.0 environment but it didn't work, it does the same thing i.e. it always lists all the WORKTYPES regardless of the asset.

    Likewise, if it works for you, it is possible that your script can solve it.

    Thank you so much!

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A. - Actively seeking employment
    ------------------------------