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
purupuru 

Salseforce Dynamic quires (SOQL /SOSL)

Can any one tell me what is Max length of dynamic SOSL/SOQL query?

 

I am building dynamic query where I am adding fields dynamically. I don't know that when my query will fail due the long query.

 

Is there any limit on length of query?

 

Thanks

Purushottam

Best Answer chosen by Admin (Salesforce Developers) 
BharathimohanBharathimohan

Hi Purushottam,

 

Yes,both SOQL and SOSL query statements cannot contain more than 10K characters.

we have a character limit of 10000 (10K) characters in the query.

 

Checkout this Link1

 Link2

 

Please Mark this post as solved, if it helps you

 

Regards,

Bharathi
Salesforce For All

 

 

All Answers

BharathimohanBharathimohan

Hi Purushottam,

 

Yes,both SOQL and SOSL query statements cannot contain more than 10K characters.

we have a character limit of 10000 (10K) characters in the query.

 

Checkout this Link1

 Link2

 

Please Mark this post as solved, if it helps you

 

Regards,

Bharathi
Salesforce For All

 

 

This was selected as the best answer
purupuru

Hi Bharathi, 

 

Thanks for your help. :)

 

I guess by simple query.length() string function we can findout the number of charaters in query.

 

Purushottam Bhaigade Software Developer, Screen-Magic
purushottam@screen-magic.com | www.screen-magic.com

 

Facebook Twitter LinkedIn
Contact me: Skype purushottam8688