I have a list of string,reqNumber, containing External Opportunity Id.

I want to pull all the Opportunities belonging to the external Id's in reqNumber.

Following is my SOQL query

 list<Opportunity> opportunityBucket = new list<Opportunity>([Select Id,Recruiter_Name__c from Opportunity where Recruiter_Name__c IN :reqNumber]);

However the query returns no rows. reqNumber is not empty and corresponding Opportunities are available in my SF instance.

Not sure what am I missing.

1 Answer 1


Is Recruiter_Name__c a lookup to another object with external IDs? The way you have it, you need to use Salesforce IDs in reqNumber. Change your SOQL to use Recruiter_Name_r.ExternalID_c. Change ExternalID__c to the name of the field that you are looking for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .