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
MikeGillMikeGill 

Includes query giving strange error - unexpected token

Strange one comparing two multi-select using includes

 

 

	List<Account> accs = [select Id, Name, BillingCity, Country_ISO_Code__c, Type, Accreditations__c from Account where 
 	 		(Country_ISO_Code__c =: lead.Country_ISO__c) 
 	 		AND 
 	 		(Accreditations__c includes ( lead.All_Accreditation_Endorsements__c ))
 	 		Limit 1000];

 

 

Getting unexpected token, exhausted my options for now.

 

Both Accreditations fields are multi-select picklists

 

Any suggestions welcome - thanks

Best Answer chosen by Admin (Salesforce Developers) 
MikeGillMikeGill

Thanks - I think it was getting late

 

Happy Christmas

All Answers

tharristharris

I don't see a colon before you are using the variable lead.All_Accreditation_Endorsements__c in the includes clause.

 

You should try this:

 

	List<Account> accs = [select Id, Name, BillingCity, Country_ISO_Code__c, Type, Accreditations__c from Account where 
(Country_ISO_Code__c =: lead.Country_ISO__c)
AND
(Accreditations__c includes ( :lead.All_Accreditation_Endorsements__c ))
Limit 1000];
MikeGillMikeGill

Thanks - I think it was getting late

 

Happy Christmas

This was selected as the best answer