Wednesday, December 27, 2023

In the Monitor tab, we need to capture the custom header value.

 In the Monitor tab, we need to capture the custom header value.

eg-po_number value

Step 1:

Content Modifier- In the content modifier, we need to store the particular value below the image. We have stored the po_number.

Input-
<root>
    <po_number>123</po_number>
</root>
        



Groovy Scripts: In the monitor tab, we need to create a custom header with any value, and then we need to use the below Groovy scripts.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message){
      def messageLog= messageLogFactory.getMessageLog(message);
  if(messageLog != null)
{
      def po_number = message.getHeaders().get("po_number");
  if(po_number !=null)
  {
  messageLog.addCustomHeaderProperty("po_number",po_number);
  }
  }
return message;
}

Monitor Output: Now, we can see the particular field value in the monitor tab.













No comments:

Post a Comment

The sender will pass the data in JSON format without converting it to XML format. We need to read the particular field.

The sender will pass the data in JSON format without converting it to XML format. We need to read the particular field to check the conditio...