function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandy GaliSandy Gali 

SOQL Query - Workbench - Error

Hi All,
         I need to run queries as part of my work which sometimes includes more than say 800 values in 'IN' condition. When I run this query i get an error saying " Unknown Asynchronous State"
I eventually end up doing it in Dataloader where the same query works fine. 
Were any of you succesful in resolving this issue.

My query looks something like this

SELECT name,age FROM Applicant__c where name in ('A1',


Hi Sandy Gali,

First add all your name values to a SET or List then use IN operator. Below is sample code.
List<String> nameValues = new List<String>();
for(Applicant__c  ap : AppList){
List<Applicant__c>  applcList = [SELECT id,name,age FROM Applicant__c where name in: nameValues];
Best Regards,
Salesforce DeveloperSalesforce Developer
That error may be result of session timeout in workbench !
Elton PereiraElton Pereira
Try Using another browser. It worked for me.
Salesforce DeveloperSalesforce Developer
If someone else is looking for explanation, it is because of the SOQL limit of too many characters: 

"Long, complex SOQL statements, such as statements that contain many formula fields, can sometimes result in a QUERY_TOO_COMPLICATED error. The error occurs because the statement is expanded internally when processed by Salesforce, even though the original SOQL statement is under the 20,000 character limit. To avoid this, reduce the complexity of your SOQL statement."