In your scenario, is it directly JSON outbound message by selecting Publish JSON ? check box. Can you please let me know on how you read and modified the JSON content.
In my case, i need some extra information like total record count, uniqueID for message header. So, I used the JSON Mapping application. by this way, I'm not able to read values from JSON tags in user exit after Automation script.
Original Message:
Sent: Tue July 09, 2024 07:22 PM
From: Sarbjeet Singh Jassal
Subject: How to modify values in JSON outbound message from Maximo
Hi Suren,
Thank you for the response.
I ended up writing a processing class on the publish channel and it was easier to modify the outgoing JSON in there.
I believe it should be same in the Publish Channel external exit automation script as well. I could not write External Exit script as my publish channel had OOB processing class already.
Thanks,
Sarbjeet
------------------------------
Sarbjeet Singh Jassal
Original Message:
Sent: Mon July 01, 2024 09:04 PM
From: Surendar Balasundaram
Subject: How to modify values in JSON outbound message from Maximo
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
Original Message:
Sent: Mon July 01, 2024 01:02 AM
From: Sarbjeet Singh Jassal
Subject: How to modify values in JSON outbound message from Maximo
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
Original Message:
Sent: Tue April 23, 2024 11:41 PM
From: Surendar Balasundaram
Subject: How to modify values in JSON outbound message from Maximo
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:
- 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
- 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
------------------------------