0

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?

1 Answer 1

2

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)

5
  • OK, thank you. I found that info here: salesforce.stackexchange.com/questions/16084/…
    – B Seven
    Commented Jan 9, 2019 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
    Commented Jan 9, 2019 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
    Commented Jan 9, 2019 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
    Commented Jan 15, 2019 at 0:25
  • @BSeven - so, if you want it to be TRUE, you'll need to set that in your REST POST body
    – cropredy
    Commented Jan 15, 2019 at 0:27

You must log in to answer this question.

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