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.


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.

| 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.