+ Start a Discussion
cbrocbro 

Convert Lead, validation rule

Only a few specific profiles can convert leads.

 

That being said, I want to make sure those users cannot use the 'Convert Lead' button unless a checkbox field 'Lead.Validated__c' is checked.

 

I think I have the beginning of it, but I don't know how to finish it.

 

I am unsure of the part below (as it's not working) that says: 

NOT( Validated__c ) , 
Convert Lead = TRUE 
)

Here is the full rule, that doesn't work:  any help would be greatly appreciated!

 

AND( 
OR( 
$User.ProfileId ='00e80000001KC2t', 
$User.ProfileId ='00e80000001KC2s', 
$User.ProfileId ='00e80000001K8tw' 
), 
NOT( Validated__c ) , 
Convert Lead = TRUE 
)

 

Best Answer chosen by Admin (Salesforce Developers) 
cbrocbro

This is the final code that is working.  wow.  that took so long..  lol.

 

Other info that you might need to know, Validated__c is a Checkbox.

 

Note, I also had to go into the Customize > Lead > Settings > and Select Enforce Validation and Triggers from Lead Convert checkbox. (that was kind of a big deal).  but, even with that selected, the code I had was not working.  I had to turn that off because of an old trigger that was no longer necessary, which couldn't be deleted (which I finally deleted, because I could show it was no longer necessary).  

 

After working with SFDC on the phone for a while, this is the final solution that we came up with.

 

Validated__c = False && IsConverted && 
OR($User.ProfileId = "00e80000001KC2s", 
$User.ProfileId = "00e30000000eH6h", 
$User.ProfileId = "00e80000001K8tw", 
$User.ProfileId = "00e80000001KDef", 
$User.ProfileId = "00e80000001KEQv", 
$User.ProfileId = "00e80000001KENN")

 Thanks!

Chris

All Answers

klamklam

Are you trying to create a validation rule? If yes, the following should work:

 

AND(
OR(
$User.ProfileId ='00e80000001KC2t',
$User.ProfileId ='00e80000001KC2s',
$User.ProfileId ='00e80000001K8tw'
),
NOT( Validated__c ) , 
IsConverted
)

cbrocbro

Yes, a validation rule... sorry... :)

 

So - it turns out, it doesn't matter what profile it is, I don't want the lead converted unless it's been validated. (i.e. when they click the "Convert" button on the lead, I want to display an error if it has not been validated).

 

That being said, this doesn't seem to be working...

 

AND( 

NOT( Validated__c ) , 
IsConverted 
)

 

 

It's still letting anyone convert the lead, even if the checkbox field (Lead.Validated__c) is unchecked.

 

This doesn't work either...

 

AND( 

( Validated__c = false) , 
IsConverted 
)

 

Prafull G.Prafull G.
AND(
NOT(Verified__c),
IsConverted
)

Is working for me. Can you please ensure the validation rule is active. I dont think any other reason will stop this validation rule to fire.

Let us know how it goes.
cbrocbro

Salesforce.com has to turn on "Enforce Validation and Triggers from Lead Convert" and it is not one we can do on our end, according to everything I’ve read, and what I’ve heard from speaking SFDC directly today.  I even went into the settings under Leads, and there is no way for to turn it on.

 

update: This is the code given by Salesforce, but it still does not work even after enabling this Enforce Validation and Triggers from Lead Convert under Setup>Customize>Leads>Settings...  waiting on a response from Salesforce support now.  

 

AND( 
OR( 
$User.ProfileId ='00e80000001KC2t', 
$User.ProfileId ='00e80000001KC2s', 
$User.ProfileId ='00e80000001K8tw' 
), 

NOT(Validated__c), 
IsConverted 
)

 

 

I will post the code when they have turned on this rule.  

cbrocbro

This is the final code that is working.  wow.  that took so long..  lol.

 

Other info that you might need to know, Validated__c is a Checkbox.

 

Note, I also had to go into the Customize > Lead > Settings > and Select Enforce Validation and Triggers from Lead Convert checkbox. (that was kind of a big deal).  but, even with that selected, the code I had was not working.  I had to turn that off because of an old trigger that was no longer necessary, which couldn't be deleted (which I finally deleted, because I could show it was no longer necessary).  

 

After working with SFDC on the phone for a while, this is the final solution that we came up with.

 

Validated__c = False && IsConverted && 
OR($User.ProfileId = "00e80000001KC2s", 
$User.ProfileId = "00e30000000eH6h", 
$User.ProfileId = "00e80000001K8tw", 
$User.ProfileId = "00e80000001KDef", 
$User.ProfileId = "00e80000001KEQv", 
$User.ProfileId = "00e80000001KENN")

 Thanks!

Chris

This was selected as the best answer