+ Start a Discussion
Shradheya TiwariShradheya Tiwari 

Pass field name in SOOQL query


I am trying to get data using query - query?q=Select+id+from+Account+where+ABI_ID__c+=+12345

Using api and below is the code-
call = self.sf_api_call("query?q=Select+id+from+Account+where+"+field+"+=+12345", method="get")

When I am executing the script I am getting below error-
ERROR at Row:1:Column:30\\nvalue of filter criterion for field \'ABI_ID__c\' must be of type string and should be enclosed in quotes","errorCode":"INVALID_FIELD"}]'

I have tried many things but got no luck.

Can someone please help me in this?
Rounak SharmaRounak Sharma
hello shradheya,

Can you try the following way
ToolingAPI.CustomObject customObject = customObjects[0];
Id customObjectId = customObject.Id;
List<ToolingAPI.CustomField> customFields = (List<ToolingAPI.CustomField>)
     toolingAPI.query('Select Id, DeveloperName, NamespacePrefix, TableEnumOrId From CustomField Where TableEnumOrId = \'' + customObjectId + '\'').records;

Please let me know if it helps you and mark the problem as solved
Shradheya TiwariShradheya Tiwari
Hi Rounak,

Thanks for the reply mate, one thing I forgot to mention that my abve code is in Python.

Also the solution which you provided I don't think will work for me as my error is something different.

Shradheya Tiwari