Maximo

 View Only
  • 1.  How to modify values in JSON outbound message from Maximo

    IBM Champion
    Posted Tue April 23, 2024 11:41 PM

    Hi All, I'm posting this message for a help on modifying the values in header tag in JSON outbound message from Maximo  as erData.getData or erData.getCurrentData is working only for XML output message. 

    Current set up: 

    1. We have a publish channel with a single object structure (say for example, ASSET) with json mapper processing class.                                       Publish Json ? = False , processing class = com.ibm.tivoli.maximo.fdmbo.JSONMapperExit 
    2. A Json Mapping EXTSYS.PUBLISHCHANNEL.OUT for having a header & assets data to be sent in JSON format. 
    {
    "header": {
          "transactionuniqueid": "1234567321",
          "transactionDateTime": "2024-04-24T00:00:00+00:00"
          "recordCount": "2"
       }, 
       "body": {
          "assets": [
             {
                "Assetnum": "A1001"
             }, {
                "Assetnum": "A1002"
             }
          ]
       }
    }
    3. A User Exit (after processing class) is created for this publish channel   PUBLISH.<PUBLISHCHANNELNAME>.USEREXIT.OUT.AFTER

    This User Exit is used to set values for header attributes to have dynamic values for each message transaction. 

    The problem we are facing is - the erData.getCurrentData("header")  & erData.getChildren("header")- is returning null . I'm able to read the JSON mapped message using erData.getDataAsString() - but not able to modify the values before it is sent to end point. 

    I read from previous posts that we cant modify the string and pass it on to external system. The data in JSON can only be modified using StructureData methods (setCurrentData )

    Please let me know the technical limitation on modifying the tag values in JSON outbound message from Maximo. 

    We are looking to modify the values after parsing it as String, use this payload to call another end point from user exit class & skip transactions in this publish channel for all messages.  resp = JSON.parse(erData.getDataAsString())    resp["header"]["transactionuniqueid"] = "123456789"

    Thanks, 

    Suren



    ------------------------------
    Surendar Balasundaram
    ------------------------------


  • 2.  RE: How to modify values in JSON outbound message from Maximo

    Posted 2 days ago

    Hi Surendar,

    I was wondering if you got this working. I am also looking to change the outgoing JSON in Publish Channel AFTER class and getting the values as null from erData.

    Regards,
    Sarbjeet



    ------------------------------
    Sarbjeet Singh Jassal
    ------------------------------



  • 3.  RE: How to modify values in JSON outbound message from Maximo

    IBM Champion
    Posted 2 days ago

    Hi Sarbjeet, 

    The only method which is working for me on publish channel AFTER after JSON Mapping is erData.getDataAsString() .

    I retrieved the JSON using erData.getDataAsString() and modified the values by String manipulation & JSON set values  [ resp = JSON.parse(erData.getDataAsString()) ].

    The final JSON String is created & using another end point I pushed this desired message to other system.

    response = service.invokeEndpoint("NEWENDPOINT",metaData,jsonNewString )

    Please reply for more information and I'm happy to help.

    Thanks, 

    Suren



    ------------------------------
    Surendar Balasundaram
    ------------------------------