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
KateKHallKateKHall 

Canceling validation rules based on lead stage?

Hello Salesforce World!

I have a number of validation rules set up for leads.

This is for making sure details are there as the lead proceeds it's life from Lead to Opp.

However, I want to cancel most of my validation rules if in the discovery process the lead is unqualified or is to be closed.

Please Help!

KimKim
Hi Kate,

I'm assuming during 'discovery process', the lead status is updated to 'unqualified' or 'closed'? If they are, you'll need to update the validation rules that you do not want to fire/trigger if the lead status = 'unqualified' or 'closed'.
KateKHallKateKHall

Correct, during the discovery process either the information that needs to be filled in, must be entered, I set up validation rules for those.

Or if they are 'unqualified' or 'closed' I don't want those rules to fire.

I'm just not finding the code to kill the validation rule for those statuses.  

KimKim
Sounds like there's no actual validation rules created on the lead object but maybe a trigger on the lead that's firing the check if the value is 'unqualified' or 'closed' it should throw the error? You can open up a developer console, go to EDIT >> Search in Files and enter the field that would contain the value "unqualified' or 'closed' to check what triggers are referencing that field. That would be a backwards way of finding the process that's firing it.
KateKHallKateKHall

I personally created the validation rules on the lead object.

I want to turn them off ONLY if the lead is marked unqualified.

So as an example:

Lead:

(All of these are gathered on their initial call or web submission.)

First name Last Name

Phone Email

Follow up Call:
(These have validation rules set up they must be filled out)

Size

Rental or Purchase

Approx start date of the project 

However, they are disqualified in this call and we don't get some or all of the follow-up fields.

AS it stands if anyone tries to change the status to contacted qualified, I want those rules to run!
If its contacted unqualified, the rules still fire. I don't want them to. It's a dead lead and we don't need that information. And I don't want my reps filling in false info just to change the status! I want to kill the rule if the lead is unqualified.