Maximo

Maximo

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

 View Only
  • 1.  Object structure automation script question

    Posted Fri July 03, 2020 09:04 AM
    Hello everyone,

    I am new to using object structure automation scripts but with the IBM documentation i have figured out how to do a simple validation before data gets written in the objects:

    function beforeMboData(ctx) {
        structData = ctx.getData();
        if (structData.getCurrentData("SERVRECTRANSID")) {
            ctx.error("servrectrans", "nofillservrecid")
        }
    }

    Now i am trying to validate if a combination of two fields in the object structure is repeated in others lines but i havent figured out how to do a "for" or a "while" with all the object structure data. I was thinking something like this:

    function beforeMboData(ctx) {
        x = 0;
        while 
           /-- Variables should be compared here  --/
               /-- If variables are found in another line --/
               x = 1;
         
        if (x == 1) {
            ctx.error("servrectrans", "repeatcodserv")
        }
    }

    Any advice will be helpful.

    PD: English is not my main language, sorry for the grammar.

    ------------------------------
    Arturo Carmona Lozano
    ------------------------------

    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Object structure automation script question

    Posted Mon July 06, 2020 02:24 AM
    Hi Arturo,

    Could you explain what your use case is in a bit more detail so we understand the requirement?

    ------------------------------
    Steve Lee
    Maximo Technical Sales Specialist
    IBM
    Leeds
    ------------------------------



  • 3.  RE: Object structure automation script question

    Posted Mon July 06, 2020 10:36 AM
    It sounds to me like you just need a link to the API documentation for StructureData. You can get to it from this APIs and SDKs page, which has links to other good resources, too. The JavaDocs are for Maximo 7.6.0.9, but they should be mostly reliable for any 7.x version.

    ------------------------------
    Blessings,
    Jason Uppenborn
    Sr. Technical Maximo Consultant
    Ontracks Consulting
    ------------------------------