Friday 5 April 2019

XML tag/XML Node removal from XML data


When required to remove the xml tag from the xml data for the futher transformation steps, then below grovvy script will be used to achieve this functionality.

Groovy Script:


import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.io.*;


def Message processData(Message message) {

//Body

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

body = body.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim();

message.setBody(body);

return message;

}



Thursday 4 April 2019

ODATA filter for Mobile number

When trying to use the mobile number filter criteria in the ODATA functionality, it may not retrieve the data, so there is solution for it.

https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/IndividualCustomerCollection?$filter=Phone eq %2B91 9873263245'

The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character with its hexadecimal value as %2B.

Your corrected filter should then be $filter=Mobile eq '%2B46 123456789'