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?