Skip to Content

SCPI Groovy Script to Read Header Parameters

Team,

I am writing Grrovy script in iFlow. I want to know how I can read Message Header * Properties in script & update values.

Thank you in advance,

Mahantesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 24 at 01:41 PM

    Hello Mahantesh,

    Please find the below.

    import com.sap.gateway.ip.core.customdev.util.Message;
    import java.util.HashMap;
    
    def Message processData(Message message) {
    
    	//Body 
    	def body = message.getBody();
    	message.setBody(body + "Body is modified");
    	
    	//Get Headers 
    	def map = message.getHeaders();
    	def value = map.get("oldHeader");
    	//Set Headers
    	message.setHeader("oldHeader", value + "modified");
    	message.setHeader("newHeader", "newHeader");
    	
    	//Get Properties  
    	map = message.getProperties();
    	value = map.get("oldProperty");
    	//Set Properties 
    	message.setProperty("oldProperty", value + "modified");
    	message.setProperty("newProperty", "newProperty");
    	
    	return message;
    }
    

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded