+ Start a Discussion

Validation around Converting Leads

Has anyone come up with code to override the Convert Lead button so that it can only execute when certain fields within the Lead record have been completed?
No, but I would look forward to seeing this. 
I don't write code - but I've gotten pretty code at doing almost everything without it. What i would do here - create another record type. on 2nd record type (and corresponding page layout) input the convert button. on the first page, do NOT have the convert button. create workflow rules based on formula - to update the record type if all your fields are correctly filled in, otherwise there is no option for user to convert . .. .


We have a piece of code in place that looks to see if the customer already exists or not - if not, it does not allow you to complete the conversion. I don't know how familiar you are with scontrols but I'd imagine you would do a javascript with the following logic:

IF Lead.fieldvalue1 == somestring


URLFOR($Action.Lead.Convert etc)


Error Message alert


This would take the user back to the lead they tried to convert unless the condition in the IF statement is met.

If you need additional help with the code let me know and I can try to whip up something more detailed if needed.
I'd like to check to make sure my Lead.Industry field does not equal 'TBD' when the user clicks the 'Convert' button.  I created this s-control (as a snippet):
{!IF(ISPICKVAL( Lead.Industry , 'TBD'), URLFOR( $Action.Lead.View , Lead.Id), URLFOR($Action.Lead.Convert, Lead.Id ) )}

This (ideally) would just kick the user back to the Lead View screen if true, otherwise bring them to the Lead Convert screen.  Is this even close?

I know this isn't all I have to do, so I'm here to ask what to do next....  I have no clue.  I have this s-control created, now what?

(I know I'll need to add some error message as to why they couldn't convert the lead too, but baby steps here...)

Steve :-/Steve :-/
You can enforce Lead validation for required Contact and Account fields now.  You need to have SF Support to activate the feature on your SF.Org

Once it is activated go to:

  • Setup>
  • Leads>
  • Settings>
  • Enforce Validation and Triggers from Lead Convert