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
Mike McGeoyMike McGeoy 

Lead Validation rule with excepetions

I am trying to accomplish a validation rule (or set of rules) which "in general" will not allow the user to move backwards in the Lead Status process however there are a few exceptions to the rule where the user can move backwards in two specific cases. 

I incorporated a great rule which allows me to prohibit values from moving backwards but can't figure out how to exclude the two cases where moving backwards is okay.

Lead Statuses (in order)
New
MQL**
Nurture*
Qualified
Customer
Non-Prospect
Unqualified*
Wrong contact
No Loner w/ Co
Remove

Based on of our lead marketing definitions and processes we need the ability to move a Lead who is in the Nurture* or Unqualified* status back to the MQL** status only.

I tried the following, which works great but can't figure out how to allow for exceptions:
CASE( Status , 
"New",1, 
"MQL",2, 
"In Progress",3, 
"Re-Market",4, 
"Qualified",5, 
"Customer",6, 
"Non-Prospect",7, 
"Unqualified",8, 
"Wrong Contact",9, 
"No Longer w/Co",10, 
"Remove",11,0) 
< 
CASE(PRIORVALUE(Status) , 
"New",1, 
"MQL",2, 
"In Progress",3, 
"Re-Market",4, 
"Qualified",5, 
"Customer",6, 
"Non-Prospect",7, 
"Unqualified",8, 
"Wrong Contact",9, 
"No Longer w/Co",10, 
"Remove",11,0)
I can't imagine that what I am trying to do is not possible...  Help is greatly appreciated
Mike




 
logontokartiklogontokartik
Hi Mike, you almost figured it out, 
You just need to add an AND condition and it should work. Something like below
 
CASE( Status , 
"New",1, 
"MQL",2, 
"In Progress",3, 
"Re-Market",4, 
"Qualified",5, 
"Customer",6, 
"Non-Prospect",7, 
"Unqualified",8, 
"Wrong Contact",9, 
"No Longer w/Co",10, 
"Remove",11,0) 
< 
CASE(PRIORVALUE(Status) , 
"New",1, 
"MQL",2, 
"In Progress",3, 
"Re-Market",4, 
"Qualified",5, 
"Customer",6, 
"Non-Prospect",7, 
"Unqualified",8, 
"Wrong Contact",9, 
"No Longer w/Co",10, 
"Remove",11,0) && (TEXT(Status) != 'MQL' && (PRIORVALUE(Status) != 'Nurture' || PRIORVALUE(Status) != 'Unqualified'))

 
Mike McGeoyMike McGeoy
Hi Kartik,
 
Thanks for your response and your additions certainly got me further along but I’m still missing a key component here.
 
I moved some of the Lead Statuses around but kept the validation rule structure which I started with and you helped me to augment.  It’s working better but still not giving me the end result I am looking for. 
 
Given the Lead Statuses I have, and in the order they appear I need to be able to accomplish two things with a validation rule:
#1 In general no lead status can change backwards with the exception of
#2 The “Unqualified” and “Re-Market” statuses should be able to be change back to the “MQL – Follow Up” status and only that status
 
What I am finding with  the additional code you suggested is that  #1 works fine in that in general backwards movement of lead status gets trapped by the validation rule, however with #2  All Prior Values are allowed to be reset back to “MQL - Follow Up” instead of just the “Unqualified” and “Re-Market” values.   Just to further Clarify the “Customer” value as an example should never be able to move backwards but with this validation in place it can erroneously be reset to “MQL – Follow Up”.
 
Here again is the validation rule I have in place so far:
______________________________________
CASE( Status ,
"Open",1,
"New",2,
"MQL - Follow Up",3,
"In Progress",4,
"In Progress - Further Activity",5,
"Re-Market",6,
"Unqualified",7,
"Non-Prospect",8,
"Wrong Contact",9,
"No Longer w/Co",10,
"Remove",11,
"Qualified",12,
"Customer",13,
"Approved",14,0)
<
CASE(PRIORVALUE(Status) ,
"Open",1,
"New",2,
"MQL - Follow Up",3,
"In Progress",4,
"In Progress - Further Activity",5,
"Re-Market",6,
"Unqualified",7,
"Non-Prospect",8,
"Wrong Contact",9,
"No Longer w/Co",10,
"Remove",11,
"Qualified",12,
"Customer",13,
"Approved",14,0) && (TEXT(Status) != 'MQL - Follow Up' && (PRIORVALUE(Status) != 'Re-Market' || PRIORVALUE(Status) != 'Unqualified'))
______________________________________
I appreciate any assistance you (or anyone) can provide for what I believe should be doable.
 
Thanks!
Mike