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
MSVRadMSVRad 

How to require a field for Lead Conversion

I want to make the state/province field required on a lead when a user tries to convert the lead to an account. The state field is not required when the lead is created as the user may not know the state at this point.  When the user is ready to convert a lead the state field needs to be known and populated.  The issue is how to make it required only on the conversion and not on the save. I have thought about validations rules, workflow rules and possibly a trigger.  Though I encounter the problem of the required state error occurs on the save not on the conversion.
lee_carter73lee_carter73

The only way i seemd to be able to do it was write a validation rule off the lead status field = qualified.  Pretty sure the convert button does a field update on lead status to qualified.  So if they try to convert from say lead status = open they will get an error at the lead conversion screen.  The error isn't very descriptive but none the less it requires them to go back and fill in the required field.  Then we just tell our users the best practice is change the status to qualified then convert.  If someone has a better way i would be interested in hearing it.

 

 

MSVRadMSVRad

This is the validation I wrote.  It did not work.  Is there something I am missing?

 

AND( ISPICKVAL(Status, "Qualified"), ISNULL(State) )

 

GabeGabe
I was working on something similar recently and tested the script in this post in my account, and it worked great - should do exactly what you want. The script in question checks to see if lead status is qualified before converting, so you should be able to adapt that to check state value pretty easily.
lee_carter73lee_carter73
State is a text field so isnull won't work.  Do State = ""
MSVRadMSVRad

I am trying to keep away from S-Controls since Salesforce is not going to support them in the future(So it says in the Spring 09 Release). 

 

The solution that I came up with is thanks to lee_carter73, your suggestions led me in the right direction for what I needed.

 

AND( ISPICKVAL(Status, "Qualified"), LEN(State) = 0 )

 

 

This is the Validation Rule that I came up with and it works correctly.  If the Lead Status is chosen as Qualified and the State field is empty then an error occurs. It does require the the user to make use of the Lead Status field, since the Label of the Lead Status field changes in the Convert page to "Converted Status" and I cannot find the name of this field anywhere this will have to do.

 

Thanks all for the suggestions

a.schaefera.schaefer

> I am trying to keep away from S-Controls since Salesforce is not going to support them in the future(So it says in the Spring 09 Release).

Would you mind linking to that? I can't actually find anything that would suggest such a thing.
Spring 09 Release notes mention s-controls quite a few times but never as a deprecated feature.

While I agree that one should try to avoid writing extensive code in s-controls, they are a valid addition to enhance client side user experience.
- A

Message Edited by a.schaefer on 02-04-2009 01:19 AM
MSVRadMSVRad

 https://na1.salesforce.com/help/doc/en/salesforce_spring09_release_notes.pdf

 

The spring '09 release notes(Page 106): "Caution: S-Controls have been superseded by Visualforce pages.  Salesforce will, sometime after January 2010, remove the ability to create and distribute new s-controls.  Existing s-controls will be unaffected."

 

Though existing s-controls will not be affected - I take that as a possibility in the future that they will no longer allow existing s-controls to function and only allow visualforce pages.  At least it seems that way with this push to not allow any new s-controls to be distributed.

 

 

Mauricio OliveiraMauricio Oliveira

Hi,

 

I have the exact same situation: I want some fields on the Lead to be mandatory when the user uses the Convert button.

 

Is there any good solution for this? I see this topic is from before S-Controls being shut down... how to solve this situation with current Salesforce release?

Mauricio OliveiraMauricio Oliveira
Just to have this registered, I solved it by making a trigger that looks to fields that are required in either Contact or Account when converting a Lead.
ekatsanosekatsanos
Hi Mauricio,
Is it possible to include the trigger for common use?
Thanks