The code below causes the error mentioned in the title. Not sure what this means or how to fix it.
Map <ID,ID> mapID = new Map<ID,ID>([SELECT ContactId, OpportunityId FROM OpportunityContactRole]);
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You can't initialize a
Map<Id, Id> from a SOQL query result. Passing a SOQL query (or list of sObjects) to the
Map constructor is valid for producing a
It's not clear from your question which Id you want to map to which other Id, but in any case, you'll need to iterate over the query results to build your