I have a requirement where in dynamic query i have to change the format of a string.Below is the way i have tried i am getting following error after adding getTempStringFormatValue
method in the below query:
expecting a right parentheses, found '('
queryString += ' AND (FirstName like :tmpsearchstring OR LastName like :tmpsearchstring OR Name like :tmpsearchstring OR EMail like :tmpsearchstring OR Phone like :getTempStringFormatValue(tmpsearchstring))';
public static String getTempStringFormatValue(String s) {
String phoneNumber;
System.debug('Phone value'+s);
if (s!=null)
{
phoneNumber = '('+s.substring(0,3)+')'+' '+s.substring(3,6)+'-'+s.substring(6,10);
System.debug('format phone'+phoneNumber);
}
return phoneNumber;
}