Working with multiple contacts in an activity.

  • 2
  • Question
  • Updated 2 years ago
  • Answered
How do we take advantage of the capability in Salesforce to attach multiple contacts to a single activity but do so within the Skuid interface?

If I have two or more contacts involved on an event or task, the only way I know to access the ability to add those multiple contacts is through the standard Salesforce interface, not through a Skuid Popup or in-line editing of a Skuid list.
Photo of jdbuerger

jdbuerger

  • 502 Points 500 badge 2x thumb

Posted 4 years ago

  • 2
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
So activities come in two flavors,  tasks and events.  Both can include multiple parties,  but they work in different ways.  Here are some sketchy ideas. 

Tasks:  When you assign a task to multiple users in the standard layout - what you are really doing is creating multiple copies of the same task.  




In Skuid this could probably be done in a two step process.  

First create the task with fields for subject, due date, etc.  

Second, show a table of users, and implement a mass action on that table that used the action framework to create duplicate tasks for all users selected.  The actions would  create new rows in the task model - and prepopulate those new rows with all the fields from the first step of the task creation. (Use the global model merge syntax {{$Model.ModelName.data.0.FieldName}} ).  It would also prepopulate the OwnerId for the task with the User ID the row in context on the users table.  This table could have filters by profile, public groups etc, if you wanted.

These tasks would be independent entities in salesforce,  and would not stay in synch if for example the due date was changed.  But I'm pretty sure that is how it works in the standard layouts too.

Events:   The Events data model includes a "EventRelations" junction object that can be used as a related list - connected to your Events object.  So create a new event model,  and a new event relations model (that has a "field from another model" condition back to the event model.)  Then build your form for Event, and a table for capturing multiple event relations. 



Much more straightforward... 

Hopefully those give you some idea about what can be done in Skuid.   Pretty cool eh? 
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
I'm not sure what you say about Tasks is true.  

When I look at a task that has 2 people assigned and I view the task from each of their contact detail pages, I'm taken to a task with the same ID.  That would allow you to update the task in one place and have that update show for the other contact as well.

When I'm running my reports, I want to count that task as being completed once with 2 people rather than 2 tasks with 2 different people.

Your answer seems to be more in line with tasks assigned to Users rather than tasks related to multiple people with the WhoID that jdbuerger is trying to do.

This will come up for me in the coming months so I'd be curious about how to do this as well.

Thanks
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Hmm.  I dug back into tasks this morning.  This is not my experience. I'd be interested in knowing whether you have some feature enabled that I do not have... 

I create a task that is assigned to multpie users: 



I look on my task list on the home page and see the task - but it only looks assigned to me: 



And finally I look at a Skuid page that shows all the tasks.  The ID's are similar,  but different. 



I've highligthed the difference. 

If any others here know the data model for Activities well, I'd love to know if there is a way to tie multiple user tasks together so they can be edited once and see changes effective everywhere.  I see no Parent ID relationship. 

Hmmm - a mystery...  
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
The confusion is in what's taking place.  You want to assign a task to 2 Users.  The initial question was to assign a task to 2 Contacts.



In this example, there is only a single Task created and both people are tied to it.  Does that help clarify?  Your explanation is 100% true and the way it works on my end as well (i'm not special...).  
Photo of jdbuerger

jdbuerger

  • 502 Points 500 badge 2x thumb
Rob .. it's NOT multiple USERS, it's multiple CONTACTS. Maybe I wasn't clear in my original query (although I did use the word "contacts" and not "users").

Example: I have a task that needs to be attached to two different people (because they're both involved). Mrs. Smith is a client and let's say Mr. Jones is an outside advisor handling part of this task. In regular Salesforce, I can attach that single activity (be it a task or an event) to both of these contact files. When I check it off (if it's a task), it shows up in both contacts as done but there was only one task created with one single ActivityID.

This is something that regular SF has offered since the Summer of '12 release (https://success.salesforce.com/ideaVi...) yet Skuid does not seem to support it (or at least I don't know how to do it in Skuid).
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thunk!  Sound of head banging on desk.  Sorry guys.. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
So a big retraction on the way Tasks with Multiple contacts work.  Thanks for forcing me to learn new things about Salesforce. 

You have to activate multiple contacts for activities in setup -> Customize -> Activities -> Activities Settings.  And it looks pretty tough to undo.  So be careful. .



Once that is done,  a new object is created and related to your tasks.  It is called TaskRelations.  This object is a polymorphic junction object that lets you associate multiple items to a task.  On your task pages, you can create models against this object - with conditions that limit the records tot he Task ID set for the page. Then you can add rows to this model for each contact that you want to add to the task.  




The polymorphic nature of the "Relation ID" may be problematic if you only want users to select contacts.  You can use  this forum post to limit which objects are available in that drop down box.... 
Photo of Grace Klingensmith

Grace Klingensmith

  • 210 Points 100 badge 2x thumb
I am trying build in the functionality to add create the same task for multiple users from a user table via a Mass Action but am struggling to have it insert one row per user selected in my task model. Has anyone implemented the process Rob Hatch described above?
(Edited)
Photo of Milan Vadhia

Milan Vadhia

  • 60 Points
How can I create the same thing using Apex code?

I
(Edited)