2

I'm creating a new Task with multiple contacts and I know the WhoId works for one contact, but what about when you want to attach multiple contacts? Is there anything like TaskRelations available in the Rest API?

I can't find anywhere that will help me save multiple contacts to the record. I can save the record and successfully get the Task Id returned. I have even tried creating a relationship similar to what is returned when I query for the TaskRelations, but didn't work.

I have also tried create a simple object with TaskId,RelationId, and IsWhat(false) that I POST to "..../services/data/{ApiVersion}/sobjects/TaskRelations/", but that doesn't work either. (The TaskId used was returned from the recently created Task).

Any help is much appreciated! I can't be the first person to try and do this.

  • It feels like I've played with every option in the workbench Rest explorer.... – BrewMate Jun 5 '16 at 2:09
  • I have answered it .Please check and work with your salesforce admin to enable the checkbox and that would enable the API and objects.Also welcome to stackexchange salesforce – Mohith Shrivastava Jun 5 '16 at 2:13
4

To enable the feature of associating Tasks with Multiple Contacts in SFDC we enable a feature known as "Shared Activities". This setting can be found in the Activity Settings via Set up Menu .

Please check below screenshot .The last checkbox "Allow Users To Related Multiple Contacts To Events and Tasks"should be checked

enter image description here

Once you enable that ,you should be able to use below API

/services/data/v36.0/sobjects/TaskRelation

Here is a simple example of how I posted and obtained the results

enter image description here

I would also explore Tree API so that I can post in bulk

Check the below URL

Composite API

|improve this answer|||||
  • 1
    Thank you for your incredibly fast response time! I just got everything working in workbench and the mac app I'm building. Next I will work on a batch load feature for performance. – BrewMate Jun 5 '16 at 2:37

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.