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
Jude Green 18Jude Green 18 

Validation rule for edit rights for multiple profiles on Opp Stage moved to Closed Won

I have been trying to add extra "allowed to edit" profiles to the rule whichalready  works fine for just sys admin to have this right.
I cannot seem to get the right formula (tried many formats)  to achieve a working version of this:
AND(
OR (
$User.ProfileId != "00ed0000000vQrA" ,
$User.ProfileId != "00e69000002MqRI" ,
$User.ProfileId != "00e1r000001RTKA" ,
$User.ProfileId != "00e69000001uDdW" ,
ISCHANGED(StageName),
TEXT(StageName) = "Closed Won"))

I looked at Permission sets, doesnt seem to offer this exact use.
I copied other examples to adapt- no success. Any help much appreciated please.
Carolina W 2Carolina W 2
See if this works.
AND(
OR (
$Profile.Name  != "XXXX",
$Profile.Name  != "YYYY" ,
$Profile.Name  != "ZZZZ" ,
$Profile.Name  != "WWW") ,
ISCHANGED(StageName),
ISPICKVAL(StageName, "Closed Won"))


P.s: I recommend you to use Profile.Name... because the ID can change from one environment to another.

P.s2:  I don't know if this is your case, but maybe you need to add  ISPICKVAL(PRIORVALUE (StageName), "Closed Won")  to include cases where the field is already with"Closed Won" chosen.

These link has some examples that may help you.
https://help.salesforce.com/s/articleView?id=sf.fields_useful_validation_formulas_oppty_mgmt.htm&type=5
https://help.salesforce.com/s/articleView?id=sf.customize_functions_i_z.htm&type=5

Howard69Howard69
Thank you for sharing the Info, I will try to figure it out more. myindigocard (https://www.myindigocard.me/)
CharuDuttCharuDutt
Hii Jude 
Try Below Validation
AND(
OR (
$Profile.Name  <> 'ProfileName 1',
$Profile.Name  <> 'ProfileName 2' ,
$Profile.Name  <> 'ProfileName 3' ,
$Profile.Name  <> 'ProfileName 4') ,
ISCHANGED(StageName),
ISPICKVAL(StageName, "Closed Won"))
Please Mark It As Best Answer If It Helps
Thank You!
Jude Green 18Jude Green 18
Hi all thank you so much for the format outline. I have set this up in sandbox, edited to the final criteria for firing the rule. The syntax works OK but it is stopping all edits to Closed Won for the Record type defined by any profile. I cannot see my logic error but there definitely is one! The requirement is to stop any other profile editing the value to Closed Won.
Any suggestions please?

AND(
OR (
$Profile.Name <> 'xx - AE - Global - MAN',
$Profile.Name <> 'xx - AE - BNL - MAN',
$Profile.Name <> 'System Administrator'),
RecordTypeId = "012690000015cA0",
ISCHANGED(StageName),
ISPICKVAL(StageName, "Closed Won"))