Maximo

Maximo

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

 View Only
  • 1.  How to insert new MEASUREMENT record when ASSET.RISK is updated using Automation Script

    Posted yesterday
    Hi ,
     
    I'm working on a requirement where I need to insert a new row into the MEASUREMENT table whenever the RISK field is updated in the ASSET application.
     
    Objective:
     
    When ASSET.RISK is updated, I want to:
     
    Compare ASSETNUM from the ASSET table and the MEASUREPOINT table.
     
    For all matching MEASUREPOINTs (MEASUREPOINT.ASSETNUM = ASSET.ASSETNUM),
     
    Insert a new MEASUREMENT record with:
     
    MEASUREMENT.MEASUREMENTVALUE = ASSET.RISK
     
    MEASUREMENT.MEASUREDATE = system date
     
     
    What I Tried:
     
    I created an Automation Script with an Object Launch Point on the ASSET object, triggered on Update, with a condition:
     
    risk != old.risk
     
    In the script, I:
     
    Queried the MEASUREPOINT MboSet using mbo.getMboSet(...)
     
    Then attempted to add a new MEASUREMENT row
     
     
    I keep getting the error:
     
    BMXAA8334E – The Object Path field requires a value.
     
    I've tried both:
     
    mp.getMboSet("MEASUREMENT")
     
    mbo.getMboSet("MEASUREMENT", "...")
     
     
     
     
    Can someone please help me with:
     
    A working example of the automation script?
     
    Proper way to insert into the MEASUREMENT table when working from ASSET context?


    ------------------------------
    Sangaiah Nimmala
    ------------------------------


  • 2.  RE: How to insert new MEASUREMENT record when ASSET.RISK is updated using Automation Script

    Posted 19 hours ago

    Hi Sangaiah,

    You can use either an Object Launch Point, but if i understand the requirement correctly, you can also use an Attribute Launch Point, on ASSET.Risk field.

    The Measurement mboSet can be read either like:

    measSet = MXServer.getMXServer().getMboSet("MEASUREMENT", mbo.getUserInfo())

    or:

    measSet = mbo.getMboSet("MEASUREMENTS") --> name of the relationship to the MEASUREMENT object to be used

    Afterwards add the entry and set the values:
    newMeas = measSet.add()

    newMeas.setValue("fieldName1", value1)

    newMeas.setValue("fieldName2", value2)

    All the required fields in the MEASUREMENT table need to be set accordingly.

    You might need to save the set as well:

    measSet.save()

    Hope this helps.



    ------------------------------
    Liliana Malaescu
    Naviam (formerly known as ZNAPZ)
    Senior Maximo Technical Consultant
    Romania
    ------------------------------



  • 3.  RE: How to insert new MEASUREMENT record when ASSET.RISK is updated using Automation Script

    Posted 19 hours ago

    Hi Liliana Malaescu,

    Thanks a lot for quick response let me try from my end and get back to you.

    With Regards

    Sangaiah Nimmala



    ------------------------------
    Sangaiah Nimmala
    ------------------------------