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
si risi ri 

Need validation change

Hi!
Requirement is to restrict certain users by entering or changing a lookup field value when a checkbox is enabled 
Here is my VR:
AND(Chexbox = true,OR(ISCHANGED (lookup), PRIORVALUE(lookup)= '' ),NOT( $Profile.Id = 'xyz') )
 But it failing to meet the requirement in some senarios.IS there any other way to write VR
SarvaniSarvani
Hi,

Please try with below code in your validation rule. Replace the field names with your custom field API names. This rules prevent from users having profileid as in quotes, checkbox is true and if lookup field is being updated by them.
 
AND( 
checkbox__c= true, 
ISCHANGED (Lookupfield__c)=TRUE , 
$Profile.Id = '00ef4000001ab2L' 
)

Note: Please use your API names of the fields in the rule or it doesn't work( API name for custom field will have __c in the end). 

Hope this helps!

Thanks