How to check for Permission Sets in Validation Rule

Recently while dealing with one of the requirement for my current project, I need to check for logged in user’s persona and based on that, write validation rules which will restrict them to do some operations.Here is the requirementLet’s say we have two personas – Change User and Change Manager. Both Change User and Change Manager can view and edit the cases, but when the case is in “In Progress” state, Change User is not allowed to update the target resolution date on the case.SetupBoth the personas – Change User and Change Manager share the same role in the role hierarchy. (I know realistically they should have different role, but in my scenario, this is what customer wants as it aligns with their organization structure). So the way to differentiate them is through permission set. As a result, I have created two permission sets – Change User and Change Manager. Assigned the permission sets to respective users. “In Progress” is a case status value and Target resolution date is a custom field on Case object.Problem facedTo implement the requirement that “Change User is not allowed to update the target resolution date on the case when the case is in In Progress state”, I need to write validation rule. But there is no way that you can check for logged in user’s assigned permission set in validation rule. There is a...

Read More