+ Start a Discussion
Jennifer.SchnellJennifer.Schnell 

Help with Validation Rule - Two fields required when opportunity is in specific stages

Need help writing a validation rule - TCV and ACV fields are REQUIRED for Stage = Solution Design, Proposal, Negotiate and Commit for two specific roles.  We have many validation rules on our opportunity object and want to make sure I am thinking of all the variables, plus my weak spots are validation and formulas.

I am trying to use the CASE Function, but I don't think I have it right.

AND((CASE(StageName ,
"Solution Design",1,
"Proposal",1,
"Negotiate",1,
"Commit",1,
0)
>
+1), $UserRole.Id <> "00eG0000001GdpN",
$UserRole.Id<>"00eG0000001Gil0", ISBLANK(TCV__c),ACV__c )
Best Answer chosen by Jennifer.Schnell
Raj VRaj V
Use below one 

 
AND(
OR(ISPICKVAL(StageName,"Solution Design"),
ISPICKVAL(StageName,"Commit"),
ISPICKVAL(StageName,"Proposal"),
ISPICKVAL(StageName,"Commit")
),
OR($UserRole.Name = "Account Execs - North America - Process-Discrete", $UserRole.Name = "Account Execs - North America - Consumer") ,

OR(ISBLANK(TCV__c),ISBLANK(ACV__c))
)

 

All Answers

Raj VRaj V
Use below one.Mofidy it based on role name
 
AND( 
OR(StageName(Prospect_II_Reasons__c,"Solution Design"),
StageName(Prospect_II_Reasons__c,"Commit"),
StageName(Prospect_II_Reasons__c,"Proposal") ,StageName(Prospect_II_Reasons__c,"Commit") ) ,
OR($UserRole.Name <> "Admin", $UserRole.Name <> "Developer",)
OR(ISBLANK(TCV__c),ISBLANK(ACV__c))

 
Jennifer.SchnellJennifer.Schnell
Thanks @Raj, is "Prospect_II_Reasons__c" a place holder, wouldn't I just need
StageName("Commit") for each stage I want this validation rule to trigger on?
Raj VRaj V
Apologies below is the correct one 
 
AND( 
OR(ISPICKVAL(StageName,"Solution Design"),
ISPICKVAL(StageName,"Commit"),
ISPICKVAL(StageName,"Proposal") ,StageName(StageName,"Commit") ) ,
OR($UserRole.Name <> "Admin", $UserRole.Name <> "Developer",)
OR(ISBLANK(TCV__c),ISBLANK(ACV__c))


 
Jennifer.SchnellJennifer.Schnell
I am using the below and receiving this message - Error: Syntax error. Missing ')'
AND(
OR(ISPICKVAL(StageName,"Solution Design"),
ISPICKVAL(StageName,"Commit"),
ISPICKVAL(StageName,"Proposal"),
ISPICKVAL(StageName,"Commit")
OR($UserRole.Name = "Account Execs - North America - Process-Discrete", $UserRole.Name = "Account Execs - North America - Consumer",)
OR(ISBLANK(TCV__c),ISBLANK(ACV__c))

I can't figure out where an ")" would be missing.  Basically if it is any of those stages listed and either of the UserRole.Names, the TCV OR ACV cannot be blank.
Raj VRaj V
Use below one 

 
AND(
OR(ISPICKVAL(StageName,"Solution Design"),
ISPICKVAL(StageName,"Commit"),
ISPICKVAL(StageName,"Proposal"),
ISPICKVAL(StageName,"Commit")
),
OR($UserRole.Name = "Account Execs - North America - Process-Discrete", $UserRole.Name = "Account Execs - North America - Consumer") ,

OR(ISBLANK(TCV__c),ISBLANK(ACV__c))
)

 
This was selected as the best answer