Salesforce Fact #824 | Simplifed check in validation rule

Suppose we have a use case in validation rule, where we need to restrict the change of some fields for all persona and if the user has a particular custom permission set assignment then the validation stays the same except for one field.

So, instead of repeating the condition check we can simplify the condition since few of the fields are anyways common:

OR(

ISCHANGED(AccountNumber),

ISCHANGED(AnnualRevenue),

IF(NOT $Permission.Test_Custom_Perm, ISCHANGED(NumberOfEmployees), FALSE)

)

In the above example, the user is restricted to update Account number, Annual Revenue and Numberofemployees fields with the exception for NumberOfEmployees if the user is assigned the Test_Custom_Perm custom permission.

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow