function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MayankDkPantMayankDkPant 

Permisssion Sets in Validation Rule

Hi,

 

My scenarion: There is a field f1 in Account page which user's of Profile say P1 can not edit(Field is not read-only) because we have used validation rule to stop them from editing. What bussiness wants is that there are some users of P1 profile which have permission set. If any user with this permissin set is changing the record of field f1 then validation should not trigger. I can not find any permission sets in insert field option for a validation. Is there any way I can use permission sets in validation rule.

 

Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

 

Best Answer chosen by Admin (Salesforce Developers) 
AmitSahuAmitSahu
What I can think of is :

Create a Field on User object and store the permission set name added to it may be in comma separated format, as we can assign multiple permission set to a user. Then on the validation Rule check that field for the current user in context.

All Answers

AmitSahuAmitSahu
What I can think of is :

Create a Field on User object and store the permission set name added to it may be in comma separated format, as we can assign multiple permission set to a user. Then on the validation Rule check that field for the current user in context.
This was selected as the best answer
MayankDkPantMayankDkPant

Thanks a lot.

With Regards,

Mayank Pant

hpereirahpereira
Hi,
The workaround I am using for this is:
1 - Create a custom permission with the same name as the permission set
2 - Add the custom permission to the permission set
3 - Reference the custom permission in the validation rule: $Permission.customPermA
It is much simpler and clean than creating a new field...
Caitlin FernandezCaitlin Fernandez
@hpereira this worked perfectly for me - thank you!