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
Nick Bosch 4Nick Bosch 4 

Validation rule on changing Opportunity stages

I want to restrict all users, except admins, to our "Line of Sight - 10%" opportunity stage. Stated differently, "Line of Sight - 10%%" is the only opportunity stage a user should be able to set their opportunity to unless they're an admin. I've written the following rule. It allows admins to set to any stage like it should. However, it prevents everyone else from setting any opportunity stage. Meaning, users can't set the opportunity stage to "Line of Sight - 10%" like they should be able to. They also can't set it to any other stage but that is correct. Any idea what I'm missing?
 

AND(
	OR(
	ISNEW()
	ISCHANGED(StageName)),
	NOT(ISPICKVAL(StageName, "Line of Sight - 10%")),
	$Profile.Name <> "Admin")
Thank you,
Nick
Prakash NawalePrakash Nawale
Hi Nick,

Please add below code in validation rule
 
AND(
    $Profile.Name <>'Admin',
    ISPICKVAL(StageName, 'Line of Sight - 10%'),
    OR(ISNEW(),ISCHANGED(StageName))
)

Please let me know if you need any further assistance.
Varun SinghVarun Singh
Hi 
i think you have to use profile  as 'System Administrator'
 
AND(
    $Profile.Name <>'System Administrator',
    ISPICKVAL(StageName, 'Line of Sight - 10%'),
    OR(ISNEW(),ISCHANGED(StageName))
)

 
krishnak2krishnak2
HI,


Please try the below

AND(

    $Profile.Name <>'System Administrator',

   NOT( ISPICKVAL(StageName, 'Line of Sight - 10%')),NOT(ISBLANK(TEXT( StageName )))


)

 
Nick Bosch 4Nick Bosch 4
All - Thank you for the help. There was a simple but frustrating error in my original code. I was missing an imperceptible difference in the API name for "Line of Sight - 10%", which was causing all formulas to fail. I ultimately used a version of Prakash's code - I added a NOT before your ISPICKVAL" line.
 
AND( 
$Profile.Name <>'Admin', 
NOT(ISPICKVAL(StageName, "Line of Sight – 10%")), 
OR(ISNEW(),ISCHANGED(StageName)) 
)