I'm trying to use IN operator in my SAQL dynamically while doing callout using rest API.

If I'm trying to use hardcoded in operator it’s working.


q = filter q by 'Category' in ["Appliance","Testing"];

Not working:

'q = filter q by \'Category\' in' + list;

I guess it's because the list contains values in single quotes like ['Appliance','Testing']

Is there a way to automatically convert it to double quotes? Or I need to create it manually


I ended up creating my own list as string:

Account accObj = [select Id, GroupData__c from Account where Id = '0014axxxx AAE' limit 1];

List<string> groupList = accObj.GroupData__c.split(';');
List<string> parentGrouping = new List<string>();

for(string str : groupList){
    List<string> subList = str.split(':');

string stri = '[';
Boolean isFirst = true;
for(string st : parentGrouping){
        stri += '"'+st+'"';
        isFirst = false;
        stri += ',"'+st+'"';
stri += ']';
system.debug('>>> stri... '+stri);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.