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
sami amisami ami 

Validation rule to avoid updating field based on user profile.

I am trying to create a rule.This is my criteria:

 

I have a field on Opportunity which will change with workflow or either admin CAN only change.I need a rule so that other users can't update that field.

 

How can I say that admin and workflow can change the field but not other users..Please help!!

Jason CurtisJason Curtis

I don't think you need a rule. Just set the field level security for that field to "Read Only" for everyone except the System Admin. Everyone will still be able to see it but will not be able to edit it. Does this solve the problem or am I missing something?

j

 

Jason CurtisJason Curtis

Here is a relevant help page with a video:

 

 

http://na14.salesforce.com/help/doc/en/admin_fls.htm

 

j

 

TheDoctorTheDoctor

Further to the above comments, anyone using the standard System Administrator profile have the 'Edit Read-Only Fields' permission enabled by default, so you can just set this to Read-Only for all Profiles, and Sys Admin will still be able to update, as will Workflow.

liron169liron169

As mention you don't need WF.

 

But generally you can check if user is not admin by:

 

$Profile.Name <> 'System Administrator'

sami amisami ami
I was looking for Validation rule.Anyways thanks.
liron169liron169

The way you using in WF, you can also use it in validation rule:

 

$Profile.Name <> 'System Administrator'

sfdcboysfdcboy
We could write validation rule as :
if any field is changed and profile is not as desired then throw an error :
Below example is if user with not System administrator profile tries to update Stage name 
ischanged( StageName ) &&  $User.ProfileId != 'System administrator profile id '