Maximo

 View Only

How to modify values in JSON outbound message from Maximo

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

    IBM Champion
    Posted 25 days ago

    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
    ------------------------------