Maximo Open Forum

 View Only
  • 1.  MIF processor ingror changes of processing Mbo in scripts

    Posted 15 days ago

    Hi!

    We using IBM Maximo 7.6.1.3

    I have a next problem. We have some customization on ASSET mbo, made with scrips on SAVE.

    Script set svalue of the attribute, based on the value in this attribute and some other rules. 

    In UI it works fine, no problems. 

    But, when we have changes of Mbo from MIF, script acts, but any changes of primary MBO are ignored.

    It means:

    we have mbo with attribute "ZZZ" (even tried with description) = "111". 

    we have in import json (xml. csv doesnt make difference) the value ZZZ  = "123"

    Script should change this value to 321 by mbo.setValue("ZZZ", "321")

    after mbo saved value is "123".

    what interesting, in debugging, i have that script setValue ignored:

    System.out.println("ISA: mbo.getString(\"ZZZ\") = " + str(mbo.getString("ZZZ"))); 
    #output zzz = 123 as in JSON 
    mbo.setValue("ZZZ","321")
    System.out.println("ISA: mbo.getString(\"ZZZ\") = " + str(mbo.getString("ZZZ")));
    #output zzz = 123 as in JSON 

    I tried to do same way, but in script for inregration (objectscruture Inbound processing)

    Result is same:

    def afterMboData(ctx):
        System.out.println("ISA: afterMboData " + str(ctx));
        System.out.println("ISA: afterMboData " + str(ctx.isPrimary()));
        System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMbo()));
        if ctx.getPrimaryMbo() and ctx.getPrimaryMbo().getName() == "ASSET":
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMbo().getString("DESCRIPTION")));
    # output as in JSON
            ctx.getPrimaryMbo().setValue("DESCRIPTION",  "...");
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMbo().getString("DESCRIPTION")));
    # output as in JSON   
        if ctx.getPrimaryMboSet() and  ctx.getPrimaryMboSet().getName() == "LOCATIONS" and ctx.getPrimaryMboSet().getMbo(0):
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMboSet().getMbo(0).getString("DESCRIPTION")));
    # output as in JSON
            ctx.getPrimaryMboSet().getMbo(0).setValue("DESCRIPTION",  "...");
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMboSet().getMbo(0).getString("DESCRIPTION"))); 
    # output as in JSON
    
    def preSaveRules(ctx):
        System.out.println("ISA: preSaveRules " + str(ctx));
        System.out.println("ISA: preSaveRules isPrimary " + str(ctx.isPrimary()));
        System.out.println("ISA: preSaveRules getPrimaryMbo " + str(ctx.getPrimaryMbo()));
        System.out.println("ISA: preSaveRules getPrimaryMbo is locations" + str(ctx.getPrimaryMbo().getName() == "ASSET"));
        if ctx.getPrimaryMbo() and ctx.getPrimaryMbo().getName() == "ASSET":
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMbo().getString("DESCRIPTION")));
    # output as in JSON
            ctx.getPrimaryMbo().setValue("DESCRIPTION",  "...");
            System.out.println("ISA: afterMboData " + str(ctx.getPrimaryMbo().getString("DESCRIPTION")));
    # output as in JSON

    Any ideas, why it so and how to manage it?


    #Customizations

    ------------------------------
    Andrey Ilinskiy
    Handz.on
    ------------------------------


  • 2.  RE: MIF processor ingror changes of processing Mbo in scripts

    Posted 4 days ago

    Hi @Andrey Ilinskiy!

    Maybe MIF modifies before the script runs.

    I understand that it is possible in the script to use the postSave event to save it after it is saved, in order to try to make the script run after MIF modifies the data.

    def postSave(mbo):

    Regards!



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