0

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"
)
  • 1
    is Client Name a Custom Field? or are you referring Client Name as OwnerId? – Dhananjay Patil Jul 28 '17 at 10:50
  • sorry yes thats the Client Name, Ive edited that in the code above. – Tinkerbell Jul 28 '17 at 10:51
  • @DhananjayPatil I came up with this :- AND( $Profile.Name = 'Business User', ISCHANGED( Name ) ) but i'm not sure how to check the permission set ? – Tinkerbell Jul 28 '17 at 10:52
1

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:

$Setup.CustomSettingName__c.CheckboxField__c = False/True(Based on the value you set in custom setting).

Its a very easy approach.You can use the same in apex code if you want to bypass those users in future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.