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
Christophe LucchiniChristophe Lucchini 

validation rule changing stage in opp

Hi Everyone !

We want to make a validation rule on the Object "Opportunity", the rule is basically:

We want to check the profile of the user editing the opportunity :
If the profile is Sales User/CSE/Technician/Project manager user/Sales & services
And the stage of the opportunity he want to put is :
Verbal / Contract / Launched / Invoiced / Closed

So if all this is gathered, an error message is displayed:"You can't change the stage with this profile."

Here is the formula i put on the validation rule :
AND( 
$Profile.Name = "Sales User", 
$Profile.Name = "CSE", 
$Profile.Name = "Technician", 
$Profile.Name = "Project Manager User", 
$Profile.Name = "Sales & Service", 
ISCHANGED(StageName), 
OR( 
text(StageName) = "Contract", 
text(StageName) = "Launched", 
text(StageName) = "Invoiced", 
text(StageName) = "Verbal", 
text(StageName) = "Closed" ))
And no error message when i try this from the profile i list and the stage i list too, please someone can help ?

Thanks !




 
Best Answer chosen by Christophe Lucchini
Sagar PatilSagar Patil
Try this,
AND( 
OR(
$Profile.Name = "Sales User", 
$Profile.Name = "CSE", 
$Profile.Name = "Technician", 
$Profile.Name = "Project Manager User", 
$Profile.Name = "Sales & Service"),
ISCHANGED(StageName), 
OR( 
text(StageName) = "Contract", 
text(StageName) = "Launched", 
text(StageName) = "Invoiced", 
text(StageName) = "Verbal", 
text(StageName) = "Closed" ))

 

All Answers

Sagar PatilSagar Patil
Try this,
AND( 
OR(
$Profile.Name = "Sales User", 
$Profile.Name = "CSE", 
$Profile.Name = "Technician", 
$Profile.Name = "Project Manager User", 
$Profile.Name = "Sales & Service"),
ISCHANGED(StageName), 
OR( 
text(StageName) = "Contract", 
text(StageName) = "Launched", 
text(StageName) = "Invoiced", 
text(StageName) = "Verbal", 
text(StageName) = "Closed" ))

 
This was selected as the best answer
Christophe LucchiniChristophe Lucchini
Hi Patill,

Thank you very much its working !