Need help with a validation rule for when Stage changes - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
John SchallauJohn Schallau 

Need help with a validation rule for when Stage changes

Can someone please help with the validation rule logic for this scenario?

Given an error message when user changes Stage value from "Pursuit" to "Proposal" if "Picklist A" and "Picklist B" values are both "No".

 
Best Answer chosen by John Schallau
Anel MalabananAnel Malabanan
Try this:
 
AND(
ISPICKVAL(PRIORVALUE(StageName), "Pursuit"),
ISPICKVAL(StageName, "Proposal"),
TEXT(PicklistA__c) = "No",
TEXT(PicklistA__c) = "No"
)

 

All Answers

Anel MalabananAnel Malabanan
Try this:
 
AND(
ISPICKVAL(PRIORVALUE(StageName), "Pursuit"),
ISPICKVAL(StageName, "Proposal"),
TEXT(PicklistA__c) = "No",
TEXT(PicklistA__c) = "No"
)

 
This was selected as the best answer
Steve MolisSteve Molis
Give this a try
AND(
ISCHANGED( StageName ) ,
TEXT( StageName ) = "Proposal", 
TEXT(PRIORVALUE(StageName)) = "Pursuit" ,
OR(
ISBLANK(TEXT(PicklistA__c)), 
ISBLANK(TEXT(PicklistB__c))
) 
)

 
Atul SinghAtul Singh
Hi John,
Try below formula in the Validation Rule,  and let me know if this helps you out.
AND(  
      ISCHANGED( StageName), 
      TEXT(PRIORVALUE(StageName))== "Pursuit",   
      ISPICKVAL( StageName , 'Proposal'), 
      ISPICKVAL( Picklist A , 'No'),
      ISPICKVAL( Picklist B , 'No') 
)
Thankyou!
Steve MolisSteve Molis
You could also do something like this
AND(
OR(
ISBLANK(TEXT(PicklistA__c)), 
ISBLANK(TEXT(PicklistB__c))
),
ISCHANGED( StageName ) , 
CASE( StageName , 
"Prospecting",1, 
"Qualification",2, 
"Pursuit",3, 
"Proposal",4, 
"Negotiation/Review",5, 
"Closed Won",6, 
0) > 3 
)

 
Steve MolisSteve Molis
My bad I missed the "No" values 
AND(
ISCHANGED( StageName ) ,
TEXT( StageName ) = "Proposal", 
TEXT(PRIORVALUE(StageName)) = "Pursuit" ,
OR(
TEXT(PicklistA__c) = "No", 
TEXT(PicklistB__c) = "No"
) 
)

 
Steve MolisSteve Molis
My bad I missed the "No" values 
AND(
ISCHANGED( StageName ) ,
TEXT( StageName ) = "Proposal", 
TEXT(PRIORVALUE(StageName)) = "Pursuit" ,
OR(
TEXT(PicklistA__c) = "No", 
TEXT(PicklistB__c) = "No"
) 
)

 
Steve MolisSteve Molis
AND(
OR(
TEXT(PicklistA__c) = "No", 
TEXT(PicklistB__c) = "No"
),
ISCHANGED( StageName ) , 
CASE( StageName , 
"Prospecting",1, 
"Qualification",2, 
"Pursuit",3, 
"Proposal",4, 
"Negotiation/Review",5, 
"Closed Won",6, 
0) > 3 
)

 
John SchallauJohn Schallau
Thank you everyone for the fast replies.  I feel so fortunate to have the help from the Success Community!!