function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Julie BachmanJulie Bachman 

Is there way to attach a contact to multiple account using REST API ?

I already have a contact attach to one account. I can manually attach the contact to another account but is it possible to attach that contact to another account throgh rest api?
NagendraNagendra (Salesforce Developers) 
Hi Julie,

You can do this with AccountContactRole https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_intro.htm object. It's a related list under Account, you might have it hidden on the page layout.

Check the help:  The data model. And also Primary Contact for Account https://salesforce.stackexchange.com/questions/9855/primary-contact-for-account for some sample usage & considerations.

You will still need to populate Contact.AccountId with one of these accounts or it'll be considered a private contact (sharing rules don't work on private contacts so it'd be invisible for most of the users).

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra