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
Salesforce seekarSalesforce seekar 

Validation rule : If a user logging with salerep profile , in Opportunity , stage picklist he should be unable to select a value called Needs Analysis.

Hi ALL , 
 If a user logging with salerep profile , in Opportunity , stage picklist he should be unable to select a value called Needs Analysis.

please correct my rule :
AND 
( $Profile.Name = "Sales Profile" && 

Not( 
ISPICKVAL(StageName, "Needs Analysis") 

)
 
Best Answer chosen by Salesforce seekar
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi , 

Please find the below formula, 

AND(ISCHANGED(StageName), TEXT(StageName) = 'Needs Analysis', $Profile.Name = 'Sales Profile')


Thanks,
Vinoth

All Answers

Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi , 

Please find the below formula, 

AND(ISCHANGED(StageName), TEXT(StageName) = 'Needs Analysis', $Profile.Name = 'Sales Profile')


Thanks,
Vinoth
This was selected as the best answer
Anupama SamantroyAnupama Samantroy
Hi,

Please use this formula 
AND(
ISCHANGED( StageName ), ISPICKVAL(StageName , 'Needs Analysis'),$Profile.Name = 'Sales Profile'
)
Thanks
Anupama
Salesforce seekarSalesforce seekar
Hi Vinoth , 

with your answer , sales guy is able to change the stage of opty picklist . it is not throwing any error . 

question : 
while logginginto sales profile as a test user , if i change the stage of an opportunty to 
'Needs Analysis'  , it should throw an error as "Sales guy cannot put the stage picklist as Needs Analysis"
 
Arunkumar RArunkumar R
Hi Salesforce Seekar,

Could you try the below one,

AND(TEXT(StageName) = 'Needs Analysis', $Profile.Name = 'Sales Profile')
 
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi Salesforce seekar, 

I have tested the below validation rule, 

AND(ISCHANGED(StageName), TEXT(StageName) = 'Needs Analysis', $Profile.Name = 'Sales Profile')

This validation rule doesn't alllow the user with profile 'Sales Profile' to Change the picklist value from anyother value to 'Needs Analysis'.

And, if already value of StageName is 'Needs Analysis' and user do not make any change in the StageName or if user changes the StageName into anyother value except 'Needs Analysis', it will allow the user to Save the record.

May I know in which case, this validation rule does not throw an error?


Thanks,
Vinoth 

 
Salesforce seekarSalesforce seekar
Hi Vinoth and ALL, 

Thanks for Replying ......... Validation rule is working . thanks alot