I have a situation where Tasks need to be created where a Task is assigned to multiple users via the Multiple Users tab on the "Assigned To" lookup field. That part works fine.

However, I need to designate a Primary Task Owner via a custom lookup field that looks up users. That Primary Owner must also be one of the assigned users on the Task.

I attempted to write a Validation Rule that checks the Primary Owner user ID against the task owner ID and checks to ensure that the Primary Owner isn't null.:

NOT(OwnerId = Primary_Owner__r.Id) && (Primary_Owner__r.Id <>"")

The validation rule works when I have only one Assigned User (owner) on the Task and the Primary Owner is the same user, but fails when I have assigned multiple users to the Task, even if one of those users is also the Primary Contact.

I checked the debug log and see that my validation rule runs multiple time, once for each user assigned. If I have two users assigned, then it runs twice. The run where the assigned user is the same as the Primary Contact passes (as expected). But the run where the assigned user is NOT the Primary Contact fails (as expected).

Is there any way to create a validation rule that would work, or do I need to write an Apex trigger?


1 Answer 1


As far as I can see:

  • there is not one task but rather as many tasks as you have assigned users to that task you initially created
    • think of it more like a task email you send to x people only just that each one is a distinct entity
    • i.e. Salesforce creates copies / duplicates of the task
  • other than through the (initial) title of the task, I am not seeing how those copies are interrelated in Salesforce
    • especially after renaming a task copy, there is no more obvious link between those tasks initially created in one go
    • otherwise, you can perfectly create two individual tasks with the same title that were never created for multiple users in the first place

All that does not speak for a meaningful implementation of 1 task => x users. In other words, to model that one may think to introduce some TaskUsers custom object with a Master-Detail- or Lookup-Relationship to a tasks. Turns out that's not an option, though.

So, if you really need something like this, you're going to need your own Task object and your own TaskUsers object that captures a given number of users related to one of those custom "tasks", with one of those having a "Primary__c" flag set... and you needing a trigger to make sure it's indeed only one user that has that privilege.

This idea captures the same problem, so please upvote: https://success.salesforce.com/ideaView?id=087300000006wbuAAA

  • At this stage the Task(s) hasn't been saved, which is why I tried to create a Validation Rule. But Salesforce appears to be treating the unsaved Task as multiple Tasks when I use the multiple user assignment. The challenge I have isn't creating a true multi-user Task, but trying to check my Primary against the list of multiple assigned users to ensure that the Primary IS one of the assigned users. I have created a Process Builder/Visual Workflow combination to "sync" the other Tasks to the Primary. I wanted to create a Validation Rule to enure that the Primary is one of the assigned users. Feb 21, 2016 at 2:59
  • You'll need to use Apex if you want the validation rule to run properly. But as tobibeer said, it isn't simple to get a identifier for you to query the tasks. Flow can't help you at this time with validation rules :( Feb 21, 2016 at 3:58
  • I think you're stuck with: 1) no validation AND 2) upvote this idea: success.salesforce.com/ideaView?id=087300000006wbuAAA
    – tobibeer
    Feb 21, 2016 at 7:50
  • Yes, without the possibility of a working Validation Rule, I would need a "before insert" Apex trigger to check the assigned users against the Primary_Owner__c field and even assign the Primary Owner as one of the assigned users if they aren't currently one of the pending assignees. I was trying to avoid writing Apex because the project scope doesn't include Apex development in this phase. Feb 21, 2016 at 21:42
  • @KarlBarndt, I don't think you even can achieve this reliably through an apex trigger, at least not a bulk-proof one, because how would you possibly know (except based on the task name alone) which tasks are, in fact, copies of one "blueprint" (the one directly assigned to that primary "owner")?
    – tobibeer
    Feb 22, 2016 at 6:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .