Make sure you are using an
API Version greater than or equal to
33.0. Any lower version will fail to compile if it references the
AccountContactRelation object. Although the documentation claims this object was introduced in API Verison 37.0, it seems that the compiler will allow it a little further back. But you might as well use the most up to date version, which is currently
Also make sure you enable the feature. Go to
Account Settings and make sure this option is checked:
Allow users to relate a contact to multiple accounts.
From Setup, enter Account Settings in the Quick Find box, then select Account Settings.
Select Allow users to relate a contact to multiple accounts.
Add the Related Contacts related list to the account page layouts that your reps use.
Because the Related Contacts related list includes all direct contacts, you can remove the Contacts related list from your account page layouts.
Easily see who’s a direct contact for the account when you add the Direct field to the Related Contacts related list.
Add the Related Accounts related list to the contact page layouts your reps use.
Easily see which account is the contact’s primary account when you add the Direct field to the Related Accounts related list.
Decide whether you want to prevent activities from automatically rolling up to a contact’s primary account. If so, from Setup, go to the Activities Setting page and deselect Roll up activities to a contact's primary account.
If you want to look at the relationships between contacts and accounts, create custom report types.