Maximo Open Forum

 View Only

 Including "header" information in JSON Mapping / Publish Channel, Publish JSON? message bodies

  • Customizations
  • Integrations
Robert Matthews's profile image
Robert Matthews posted 03-21-2024 11:50

When using a publish channel method to export data to some end point with json formatting, is it possible to include additional "header type" attribution in the body like what is available in the XML formatted message, namely--messageID, dateTimeStamp, message Source ID (ifacename?), and action. 

XML header data looks like this from Publish Channel output of XML: 

<?xml version="1.0" encoding="UTF-8"?>
<PublishONINTCONT xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDateTime="2024-03-20T16:36:25-05:00" transLanguage="EN" baseLanguage="EN" messageID="4635704.1710970585680850187" maximoVersion="7 6 20230831-1218 V7613-344" event="0">

While trying two approaches I'm coming up short one way or another on both: 

  • A. When using Publish Channel, Publish JSON? = 1, is it possible to add a message id, datetimestamp, and publish channel name? (Action is already included by the serializer. JSON message body includes this. _id is the record id on a custom object's row, not a message id. 
   "_action": "Add",
   "_event": true,
   "_id": "240299",
   "_translangcode": "EN",
  • B. When setting Publish Channel Publish JSON? = 0 and using a JSON Map, is it possible to include the attributes?
    • By adding some np attributes, populating them via script, and then adding them to a json map, it could be done for id, date, source. Not sure how to get action at all in this case. 

Is some other method preferable to produce an outbound message that includes the body and associated message attribution json formatted? 

Jason VenHuizen's profile image
Jason VenHuizen

You can do this with an integration automation script. Create a new script with Script for Integration, then select Publish Channel, your publish channel, User Exit and After External Exit.

In your script you then just add the following line:

erData.setCurrentData("attribute", "value")

The erData is an implicit variable in the script and calling setCurrentData will set whatever key / value pair you provide in the outbound message.

This will work with either JSON or XML formatted data as you are adding the value pair before the serialization occurs.