I want to create a validation rule on Account object, to lock client name changes by the 'Resource Manager'(This is a permission set). This validation rule should fire when the 'Business User' (This is a profile) edits the client name?
Im trying the following but it looks like the way I reference permission set is wrong.
AND(
$Permission.ResourceManager,
ISCHANGED(Name),
$Profile.Name = "Business User"
)
Best Answer
As per my knowledge,You can not add permission set in your validation but you can create a custom permission.Check the below link.
https://help.salesforce.com/articleView?id=000221057&type=1
But I recommend you to use custom setting(Tye:Hierarchy) instead of Permission Sets.In Custom Setting you can create a checkbox field and add the users/profiles whom you want to bypass/enforce the validation rule.Then you add those Custom setting in your validation formula as:
Its a very easy approach.You can use the same in apex code if you want to bypass those users in future.