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
Tonya Elvecrog-BakerTonya Elvecrog-Baker 

Allow two profiles to edit page when locked with validation rule

I have a validation rule set up that allows the administrator to edit the page after stage and status is changed by a team and the page is locked. I would like to allow another profile to be able to edit the page after the stage and status are changed. 
CURRENT formula: 

AND(

NOT(AND($User.ProfileId = "00e30000000dT2u, 00e40000000rTwW",OR(ISCHANGED(Installation_Stage__c),ISCHANGED(Installation_Status__c)))),

OR(
ISPICKVAL(PRIORVALUE(Installation_Stage__c), "Complete"),
ISPICKVAL(PRIORVALUE(Installation_Status__c), "Sent to GHU")
)

)

Need to add profile "00e40000000rTwW" but syntax error keeps saying I am missing a ). 


 
Maharajan CMaharajan C
Hi Tonya,

Please try the below formula:

AND(
NOT(AND(OR($User.ProfileId = "00e30000000dT2u", $User.ProfileId = "00e40000000rTwW"),
OR(ISCHANGED(Installation_Stage__c),ISCHANGED(Installation_Status__c)))),
OR(
ISPICKVAL(PRIORVALUE(Installation_Stage__c), "Complete"),
ISPICKVAL(PRIORVALUE(Installation_Status__c), "Sent to GHU")
)
)


But my suggestion here will be don't use the hard coded profile id.Instead use the profile Name like  below:

AND(
NOT(AND(
OR($Profile.Name = 'System Administrator',$Profile.Name = 'Account Reviewer'),
OR(ISCHANGED(Installation_Stage__c),ISCHANGED(Installation_Status__c)))),
OR(
ISPICKVAL(PRIORVALUE(Installation_Stage__c), "Complete"),
ISPICKVAL(PRIORVALUE(Installation_Status__c), "Sent to GHU")
)
)

Thanks,
Maharajan.C