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.

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

| improve this answer | |
  • 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.) – Dominic Scheirlinck May 31 '17 at 6:17
  • @DominicScheirlinck were you able to solve this issue? Can you explain how the issue was fixed – madawa Aug 9 '17 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 :) – Dominic Scheirlinck Aug 11 '17 at 2:24
  • @ Dominic Scheirlinck You are correct. I just updated the code version from 26 to 39 and its worked. – Dhruv Aug 21 '19 at 19:06
  • Anyone know- Is it possible to enable AccountContactRelations via API? – Seyitbek Nov 20 '19 at 22:14
1

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"]
}
| 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.