Tuesday, 8 August 2023

To pick the Attribute value where id =4 pick that value



import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

import java.text.SimpleDateFormat;

import java.util.TimeZone;

import org.joda.time.*;

import groovy.json.*


def Message processData(Message message) {

def body = message.getBody(java.lang.String) as String;

def data = new XmlSlurper().parseText(body)

def ReferenceField = data.'**'.find {it.name() == 'ReferenceField' && it.@id == '4'}?.text()

message.setProperty("RefField",ReferenceField);

return message;

}



No comments:

Post a Comment