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
tomasddtomasdd 

Restrict access to edit field only for 2 profiles

Hi,

I've a case where I have to add opportunity to change checkbox (checbox__c) to false only for 2 profiles (profile 1 and profile 2) when status on my objectABC__c is Coller OR Power

 

is it possible to do this using validation rule ?

VinayVinay (Salesforce Developers) 
Hi Tom,

You can use the validation rule to restrict to change field for 2 profiles.

Try below snippet
AND(ISCHANGED(checbox__c), OR(($Profile.Name ='Profile1'),($Profile.Name ='Profile2'))

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
SalesforcetsSalesforcets
Please try this validation (assuming objectABC__c is a picklist field)
AND(
PRIORVALUE(checkbox__c )==true ,
ISCHANGED(checkbox__c )
, OR(ISPICKVAL(objectABC__c, 'Coller'),ISPICKVAL(objectABC__c, 'Power'))
, $Profile.Id <> profile1_Id
, $Profile.Id <> profile2_Id
)
tomasddtomasdd

I have vali like below but it doesn't work - anyone knows what is wrong ?

 

AND(
ISCHANGED(checkbox__c),
OR(ISPICKVAL(picklist__c, 'Collier'),ISPICKVAL(picklist__c, 'Power')),
$Profile.Id <> 'idProfile1',
$Profile.Id <> 'idProfile2'
)

tomasddtomasdd
@Vinay I do not want to restrict access but extend access. These 2 profile should be allow to change this checkbox on false.
VinayVinay (Salesforce Developers) 
Add NOT condition and provide profile name correctly i.e idprofile1 = 'System Administrator' or idProfile1= 'Custom Sales'.
 
AND(
ISCHANGED(checkbox__c),
OR(ISPICKVAL(picklist__c, 'Collier'),ISPICKVAL(picklist__c, 'Power')),
NOT($Profile.Id <> 'idProfile1'),
NOT($Profile.Id <> 'idProfile2')
)

Thanks,