2

We have a project were we have recently enabled the feature allowing one Contact to link to multiple Accounts. We followed the directions according to the release notes and in the Developer console I am successfully able to execute queries such as:

SELECT Id, AccountId, ContactId FROM AccountContactRelation

However, when I try and execute this query remotely, I simply receive the error message:

sObject type 'AccountContactRelation' is not supported.

All queries FROM Contact or Account are successful. Does anyone know what I have to do to be able to query against AccountContactRelation?

I am not sure if it is relevant, but if I check the "Use Tooling API" checkbox in the developer console, I receive this same error for queries against AccountContactRelation, Contacts, and Accounts.

2 Answers 2

3

To make use of AccountContactRelation in query, we first need to enable this feature from Setup menu.

From Setup, enter Account Settings in the Quick Find box, then select Account Settings.

Select Allow users to relate a contact to multiple accounts.

enter image description here

Check the reference document here

5
  • Any chance you tested this answer @Devendra? It doesn't appear to work at all (obviously, you'd need to enable Multiple Accounts, but that still doesn't seem to make AccountContactRelation work with the query endpoint). (Also, the reference document you link to doesn't cover this question at all.) May 31, 2017 at 6:17
  • @DominicScheirlinck were you able to solve this issue? Can you explain how the issue was fixed
    – madawa
    Aug 9, 2017 at 8:49
  • @madawa I think I fixed this by upgrading the version of the API call I was making (to v39.0) - I think on earlier versions, the AccountContactRelation might be emulated through properties on either side, rather than appearing as a separate join-object. If that fixes it for you, feel free to create an answer and get the points :) Aug 11, 2017 at 2:24
  • @ Dominic Scheirlinck You are correct. I just updated the code version from 26 to 39 and its worked.
    – Dhruv
    Aug 21, 2019 at 19:06
  • Anyone know- Is it possible to enable AccountContactRelations via API?
    – Seyitbek
    Nov 20, 2019 at 22:14
2

If you're trying to get it to work in a Scratch Org you'll need the ContactsToMultipleAccounts feature enabled.

For example your project-scratch-def.json would contain something along the lines of:

{
  "orgName": "Acme",
  "edition": "Enterprise",
  "features": ["ContactsToMultipleAccounts"]
}
1
  • This does successfully check the box in that screenshot shown in @Devendra's answer. I'm on API 51 and could swear I still got the 'AccountContactRelation' is not supported error and had to manually uncheck and re-check before I could push my changes
    – bkwdesign
    Feb 16, 2021 at 14:04

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.