Maximo

Maximo

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

 View Only
  • 1.  Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Wed April 23, 2025 12:24 PM

    Hello,

    I need to configure "External Message ID" in enterprise service with JSON payload for Child Object attribute.

    inbound JSON payload:

    {

    "woactivity": [
        {
          "description": "Task1 ",
          "status": "",
          "taskid": 1,
          "wonum":"********",
         "et_compby": "xyz",
          "et_compcomments": "",
          "et_compdate": "2",
          "et_complcode": ""
        }
      ],
      "wonum": "xxxxx"

    }

    Enterprise service message tracking configure to display WOACTIVITY.WONUM in message tracking application 

    Please provide syntax to configure the child object attribute in ID field. Thanks..



    ------------------------------
    Nandisha MS
    ------------------------------


  • 2.  RE: Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Thu April 24, 2025 12:35 AM

    Hi Nandisha,

    Since you have a 1:n relationship between WORKORDER and WOACTIVITY, I don't think you'll be able to use it as a message ID. However, if you have modified your Object Structure relationship to have a 1:1 relationship only, you can try using $woactivity.wonum



    ------------------------------
    If this post helps, please consider accepting it as a solution to help other members find it more quickly.

    Maycon Belfort
    Cloud and Infrastructure Engineer
    Naviam
    Melbourne
    ------------------------------



  • 3.  RE: Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Thu April 24, 2025 03:41 AM
    Edited by Andrzej Więcław Thu April 24, 2025 09:16 AM

    Hi Nandisha,

    think of External Message ID or Search ID as a JavaScript expression which evaluates as one-liner to some value, preferably string in this case, where $ is a name of the variable which holds parsed JSON object (your input).

    Having said let's consider few examples.
    TIP: I used Automation Script to test this easily. This way you can experiment with your expression.

    from psdi.iface.mic import EntMicUtil
    
    msg = bytearray("""
    {
    "woactivity": [
        {
          "description": "Task1 ",
          "status": "",
          "taskid": 1,
          "wonum":"********",
          "et_compby": "xyz",
          "et_compcomments": "",
          "et_compdate": "2",
          "et_complcode": ""
        },
        {
          "description": "Task2 ",
          "status": "",
          "taskid": 1,
          "wonum":"@@@@@@@@",
          "et_compby": "xyz",
          "et_compcomments": "",
          "et_compdate": "2",
          "et_complcode": ""
        }
      ],
      "wonum": "xxxxx"
    }
    """, "utf-8")
    
    result = EntMicUtil.evaluateJSONForSrvMsgTrk("$.woactivity[0].wonum", msg)
    service.log_error("### RESULT 1: " + result)
    
    result = EntMicUtil.evaluateJSONForSrvMsgTrk("'TASK: ' + $.woactivity[0].wonum", msg)
    service.log_error("### RESULT 2: " + result)
    
    result = EntMicUtil.evaluateJSONForSrvMsgTrk("'TASKS: ' + $.woactivity.map(function(a) { return a.wonum }).join(', ')", msg)
    service.log_error("### RESULT 3: " + result)
    
    result = EntMicUtil.evaluateJSONForSrvMsgTrk("'WO: ' + $.wonum + ' / TASKS: ' + $.woactivity.map(function(a) { return a.wonum }).join(', ')", msg)
    service.log_error("### RESULT 4: " + result)

    Here's the output:

    ### RESULT 1: ********
    ### RESULT 2: TASK: ********
    ### RESULT 3: TASKS: ********, @@@@@@@@
    ### RESULT 4: WO: xxxxx / TASKS: ********, @@@@@@@@

    IMPORTANT: As per general recommendation Message Tracking should be used wisely as it can negatively impact integration processing performance. Obviously the more complex script expression the higher performance impact shall be expected.


    ------------------------------
    If this post helps, please consider accepting it as a solution to help other members find it more quickly.

    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V.
    Wrocław, Poland
    ------------------------------



  • 4.  RE: Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Thu April 24, 2025 07:34 AM

    Hi Andrzej,

    I have been trying to achieve something similar to what Nandisha is trying to do.  I even opened a case with IBM about this and their response was External message ID and Search ID could only use XPATH expressions, and theferore could only work with XML messages.

    So as you did, I tried to do this using an automation script with an object launch point on the MAXINTMSGTRK object, on save, before save.

    The problem I have is that my script never gets called.

    I never see any event on the MAXINTMSGTRK object in the logs. I see multiple events on other objects, for our other scripts, but none for MAXINTMSGTRK.

    The only way I was able to get my script to by executed (and see the event in the logs) was by configuring my launch point on the init event.  And I really would prefer not to have a script on the init event for this objet.

    This being said, I am really curious to know on which object/event you would configure your script's launch point.

    Thanks for your help.



    ------------------------------
    Gaétan Savard
    ------------------------------



  • 5.  RE: Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Thu April 24, 2025 08:04 AM

    Hi Gaétan,

    I'm afraid this neat feature of using script expression is reserved to JSON payloads. 
    For XML messages you are really left off with XPath only.

    Now getting to your key question why you cannot hook automation script to the MAXINTMSGTRK object lifecycle events?
    The reason for that is Maximo standard performance optimization which led developers to skip MBO layer and script the data into MAXINTMSGTRK and MAXINTMSGTRKDTL tables directly. 
    It means that in general there are dedicated MAXINTMSGTRK/MAXINTMSGTRKDTL MBO classes but they are never in use when the actual message tracking is triggered.
    Technically, even if you would try to go for Java customization, you wouldn't be able to achieve your goal either.

    BTW: I suspect that you might have seen your Mbo#init() script called when MAXINTMSGTRK/MAXINTMSGTRKDTLobject was loaded for read purposes e.g. in the Message Tracking application.

    To the best of my knowledge without rather nasty hacking - which I would NOT recommend doing - there is no way of getting more than MX standard offers.



    ------------------------------
    If this post helps, please consider accepting it as a solution to help other members find it more quickly.

    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V.
    Wrocław, Poland
    ------------------------------



  • 6.  RE: Need to configure External Message ID in enterprise service with JSON payload for Child Object attribute.

    Posted Thu April 24, 2025 08:57 AM

    Hi Handrzej,

    Thank you for the follow up.

    I was trying to use an automation script because IBM support (via the case I opened) told me it was not possible to display information in the External message ID and Search ID fields if the payload was JSON.

    What Nandisha did, and your examples of script expressions showed me that it is possible, and it does work.

    Based on that, I now have the begining of a solution for my problem.

    Thanks again for these ideas. This will help me a lot.

    Have a great day.



    ------------------------------
    Gaétan Savard
    ------------------------------