Print this page

Validation Rule/Formula to check if user can edit/update a field

Knowledge Article Number 000003183
Description

This validation rule checks if user can edit/update/alter/change a field.

If user doesn't have a certain profile, he cannot update this field and an error message is flashed.

Resolution

Scenario 1: I am assuming field 1, field 2, field3 cannot be updated by anyone other than Profile1_Id and Profile2_Id

Here’s the formula
 

  • (ISCHANGED(field1) || ISCHANGED(field2) || ISCHANGED(field3)) &&($User.ProfileId<>” Profile1_Id” && $User.ProfileId<>” Profile2_Id”)
  • Error message will be - You are not allowed to change this field

----------------------------------------------

Scenario 2: I am assuming field 1, field 2, field3 cannot be updated by anyone other than Profile1_Id and Profile2_Id when Stage is “Closed Won”

Here’s the formula
 

  • (ISCHANGED(field1) || ISCHANGED(field2) || ISCHANGED(field3)) &&($User.ProfileId<>” Profile1_Id” && $User.ProfileId<>” Profile2_Id”) &&ISPICKVAL(StageName,”Closed Won”)
  • Error message will be - You are not allowed to change this field

----------------------------------------------

Notes -

  • To determine the field names:
    • Go to Setup -> App Set up -> Customize -> Object (for e.g. go to Opportunities if it's an Opportunity field that needs to have this constraint) -> Fields -> Look for the Field's API name
  • To determine the Profile ID:-
    • Go to Setup ->Administer -> Manage Users -> Profiles -> Click the Profile name that needs to have this constraint -> Profile ID displayed in the URL.
    • For Example:  If URL is https://na6.salesforce.com/00e80000001C2pg, then Profile ID is "00e80000001C2pg"




promote demote