0% found this document useful (0 votes)
21 views1 page

Groovy ReplaceAll Script Example

The document contains code that processes an incoming message payload by replacing certain XML tags. It logs the incoming and outgoing payloads, and modifies some message properties before returning the message. The code takes the message body as a string, replaces tags like <Lead> with nothing, and sets the modified body back on the message. It also logs the payloads and adds a new property before returning the processed message.

Uploaded by

Mridul Manchanda
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Groovy ReplaceAll Script Example

The document contains code that processes an incoming message payload by replacing certain XML tags. It logs the incoming and outgoing payloads, and modifies some message properties before returning the message. The code takes the message body as a string, replaces tags like <Lead> with nothing, and sets the modified body back on the message. It also logs the payloads and adds a new property before returning the processed message.

Uploaded by

Mridul Manchanda
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import [Link].

Message;
import [Link];
def Message processData(Message message) {
def body = [Link]([Link]) as String;
def messageLog = [Link](message);
if(messageLog != null){
[Link]("Logging#1", "Incoming Payload")
[Link]("ResponsePayload1:", body, "text/plain");
}

body = [Link]("<Lead>","");
body = [Link]("</Lead>","");

// body = [Link]("10000000","10000001");
//body = [Link]("<Lead>","<LeadCollection><Lead>");
//body = [Link]("</Lead>","</Lead></LeadCollection>");

body = [Link]("MT_Portal_Integration","ns0:MT_Portal_Integration");
//body = [Link]("</Records></MT_Portal_Integration>","");
/*
body = [Link]("<Organization>","<Company>");
body = [Link]("</Organization>","</Company>");
body = [Link]("<Organization/>","<Company/>");

body = [Link]("<Email>","<AccountEMail>");
body = [Link]("</Email>","</AccountEMail>");
body = [Link]("<Email/>","<AccountEMail/>");

body = [Link]("<Website>","<AccountWebsite>");
body = [Link]("</Website>","</AccountWebsite>");
body = [Link]("<Website/>","<AccountWebsite/>");

body = [Link]("<Country>","<AccountCountry>");
body = [Link]("</Country>","</AccountCountry>");
body = [Link]("<Country/>","<AccountCountry/>");

body = [Link]("<State>","<AccountState>");
body = [Link]("</State>","</AccountState>");
body = [Link]("<State/>","<AccountState/>");

body = [Link]("<City>","<AccountCity>");
body = [Link]("</City>","</AccountCity>");
body = [Link]("<City/>","<AccountCity/>");
*/
[Link](body);

if(messageLog != null){
[Link]("Logging#2", "Outgoing Payload")
[Link]("ResponsePayload2:", body, "text/plain");
}

map = [Link]();
value = [Link]("oldProperty");
[Link]("oldProperty", value + "modified");
[Link]("newProperty", "newProperty");

return message;
}

You might also like