0

I need to create a validation rule in order to prevent users with TS value in picklist Service field to update the case owner to a specific queue, so basically if current owner has TS in service field he should not be able to change the owner to one queue. This validation rule should not affect system admins.

This is what I currently have:

AND(
    ISCHANGED(OwnerId),
    ISPICKVAL(Owner:User.Service_Level, "TS"),
    Owner:Queue.QueueName == "3 Level"
)

However it does not prevent users from changing the owner to this queue. Can anyone help with this?

1 Answer 1

4

You have created a Validation Rule whose criteria can never be satisfied. Because you use AND, each subcondition must be met. But you have two mutually incompatible subconditions, because the second requires the new owner to be a User, while the third requires it to be a Queue. You need to check the previous owner for TS, not the new owner.

3
  • So how can I create a validation that would actually prevent them from changing a user to this one particular queue? Becuase if I use only this AND( ISCHANGED(OwnerId), ISPICKVAL(Owner:User.Service_Level, "TS") it will prevent them from chaning the owner in all cases, right? Commented Sep 12, 2023 at 14:00
  • I believe you need to use ISPICKVAL(PRIORVALUE(Owner:User.Service_Level__c, "TS")). I don't have anywhere I can test to confirm at the moment, so I haven't added it to the answer yet.
    – Adrian Larson
    Commented Sep 12, 2023 at 15:08
  • I did a few tests and it actually worked with such formula: AND( text(Service_Level__c) = "TS", Owner:Queue.QueueName = "3 Level" ) Commented Sep 12, 2023 at 15:33

You must log in to answer this question.

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