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
WPCMSWPCMS 

Validations: How to exclude a role to the rule?

We have validations through the system that should not affect other users.

 

How can I add a formula to existing validations to say that if the person is under this role, ignore?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
goabhigogoabhigo

Then use $UserRole.Name <> 'TheRoleName'

AND ( $UserRole.Name <> 'TheRoleName' , Your existing validation logic)

All Answers

goabhigogoabhigo

'to say that if the person is under this role''  - wo is the person? Is he the owner of the record or the logged in user?

 

You can use either of these 2 :  CreatedBy.UserRole.Name = 'TheRoleName' OR  $UserRole.Name = 'TheRoleName'

 

Like, AND ( CreatedBy.UserRole.Name <> 'TheRoleName' , Your existing validation logic)

goabhigogoabhigo

Is it solved? Or do you need more clarifications?

WPCMSWPCMS

It is the person saving the record. Not who owns it. How do I complish that?

goabhigogoabhigo

Then use $UserRole.Name <> 'TheRoleName'

AND ( $UserRole.Name <> 'TheRoleName' , Your existing validation logic)

This was selected as the best answer
WPCMSWPCMS

Thanks!