[SalesForce] How to create Opportunity Validation Rules without breaking Lead Conversion

In our Salesforce process, our Opportunities have a custom Picklist field called 'Vertical' to track the industry segment of each Opportunity. I'm trying to make this a required field.

I'd like to keep other validation rules active (e.g. ensuring the Account field is properly populated, and that the Record Owner is properly specified), so I'm hesitant to work around the issue by changing the Lead Setting disabling validation rules, required fields etc. upon conversion.

I created this Validation Rule:

ISPICKVAL(Vertical__c, "")

However, with this rule in place, attempting to convert a Lead fails because the 'Vertical' Picklist has not been assigned a value. I don't want to give the 'Vertical' Picklist a default value, as that defeats the purpose of having reps select the right Vertical for each Opportunity.

Is anyone aware of a way to make this a required field for reps without breaking the Lead Conversion process?

Best Answer

The way to work around this is to have

  1. A field on the Lead called Is_lead__c (boolean) - default true
  2. Map this field to an Opportunity field called is_originated_by_lead__c in the Lead Field mappings dialog
  3. Enhance your validation rule to be

    IF (ISPICKVAL(Vertical__c, "") &&  /* fld is blank */
        ISNEW()) &&                    /* on new Oppo */
        Is_originated_by_lead__c,      /* created by lead conversion */
        false,                         /* not an error */
        ISPICKVAL(vertical__c,"")      /* otherwise check fld presence*/
     )
    
Related Topic