I tried submitting a ContactId with the Opportunity, but received

ERROR: INVALID_FIELD: No such column 'ContactId' on sobject of type Opportunity

Is there any documentation?


If you look at the schema, there is no OOTB field ContactId on Opportunity

Instead, you use the junction object: OpportunityContactRole which has two lookup keys

  • ContactId
  • OpportunityId

Of course, you can always add a custom field on Opportunity such as ContactId__c and you should check with your org's schema to see if this was already done

In general, you want to use the OpportunityContactRole as more than one contact can be associated with an Opportunity and many managed packages rely on this relationship to do useful things (e.g. Hubspot tracks Deals this way)

  • OK, thank you. I found that info here: salesforce.stackexchange.com/questions/16084/… – B Seven Jan 9 at 0:24
  • Thanks for your help. Implementing OpportunityContactRole via REST API was straightforward. Do I need to use IsPrimary or Role fields? – B Seven Jan 9 at 1:45
  • @BSeven - nope - per the Object doc, IsPrimary is defaulted on Create and Role is optional. If you do use roles, they have to be ones defined already in metadata: Setup | Customize | Opportunities | Contact Roles on Opportunities – cropredy Jan 9 at 1:58
  • FWIW, IsPrimary defaults to false using Restforce for me. I guess there could be some config that is causing it... – B Seven Jan 15 at 0:25
  • @BSeven - so, if you want it to be TRUE, you'll need to set that in your REST POST body – cropredy Jan 15 at 0:27

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.