Thursday, May 12, 2022

Groovy Script to Remove Special Characters (or) Replace String.

 We had a requirement to remove the special characters in the field using groovy script.


Groovy Script:

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

import java.util.HashMap;

import java.io.*;

def Message processData(Message message) 

{

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

body = body.replaceAll("&",""); 

message.setBody(body); 

return message; 

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...