Maximo Open Forum

 View Only
  • 1.  Changing attributes on Parent/Child Workorders that are created from PM with route

    Posted 2 days ago

    Hello,

    I am in need to set some attributes/fields on Parent/Child Workorders that are created from PM with route. I am able to do so on Parent WOs by the below mentioned automation script. However, I am not able to fetch child WOs in the same script. I have tried using in-built relationship or even MXSERVER but none worked.

    The launch point is Object based on WORKODER with SAVE Event (Add, Before Save). Please let me know how can I fetch child WOs.

    ```

    from psdi.server import MXServer
    from psdi.mbo import MboConstants
    pmnum = mbo.getString("PMNUM")
    siteid = mbo.getString("SITEID")
    wonum = mbo.getString("WONUM")
    projectId = "0"
    mxServer = MXServer.getMXServer()
    userInfo = mxServer.getSystemUserInfo()
    if pmnum:
    # 2. Fetch the parent PM record using the PMNUM relationship or a MboSet
    # pmSet = mbo.getMboSet("$GET_PARENT_PM", "PM", "pmnum = :pmnum and siteid = :siteid")
    pmSet = mbo.getMboSet("PM")
    pmMbo = pmSet.moveFirst()

    if pmMbo:
    # 3. Retrieve value from PM field
    projectId = pmMbo.getString("MSD_PROJECT")

    # 4. Copy value to the Work Order field
    mbo.setValue("MSD_PROJECT", projectId)
    childSet = mxServer.getMboSet("WORKORDER", userInfo)
    childSet.setWhere("parent = :wonum and siteid=:siteid")
    childSet.reset()

    childMbo = childSet.moveFirst()
    while childMbo is not None:
    childMbo.setValue("MSD_PROJECT", projectId, mbo.NOACCESSCHECK|mbo.NOVALIDATION)
    childSet.save()

    childMbo = childSet.moveNext()
    childSet.close()
    pmSet.close()

    ```

     


    #Assets
    #EverythingMaximo
    #WorkManagement

    ------------------------------
    Poonam Gupta
    MSD
    ------------------------------


  • 2.  RE: Changing attributes on Parent/Child Workorders that are created from PM with route

    Posted 2 hours ago

    You should use a crossover domain on the NEWTASKPARENTPMNUM attribute rather than an object save script. IBM covers this here: Special attributes available for crossover domain

    It is set on each WORKORDER during the wogen process and avoids the issue of getting access to the PMNUM from the parent record or getting to the child records. 

    Not specific to your question, but you almost never should be saving in a save launch point automation script. Either it's not needed or if it is needed, it means it's part of a separate transaction. A separate transaction can lead to partial commits which can cause all sorts of problems. 



    ------------------------------
    Steven Shull
    Naviam
    ------------------------------



Featured Podcast
Episode 1 is live: IBM Maximo Application Suite 9.2

Watch or listen to Steven Shull and Phil Runion discuss the practical MAS 9.2 updates Maximo teams should know.

Watch the Podcast
MORE by Naviam Episode 1 cover
Watch the latest episode