We are trying to run a SOQl query to extract the profileName and userRoleName corresponding to id's in the given list

SELECT Id,profile.name,userrole.name
   FROM User
   WHERE Id in ('1','2','3','4')

the maximum number of id's we are expecting to query is 20000 could i do it in a single query or do i need to split into batches and do it if you could please guide on this it would be of great help

we are trying to query the Salesforce api

  • You're running a SOQL from where? The answer depends on context. – sfdcfox Oct 18 '18 at 0:33
  • @sfdcfox we are calling the salesforce api – user2359997 Oct 18 '18 at 0:47

You'd be limited to the number of characters in a SOQL where clause (SOQL Limits) (4,000), or approximately 180 user Ids per query. Instead, use retrieve() to get up to 2,000 records per API call. This will be at least ten times more efficient than a straight SOQL query.

| improve this answer | |

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.