Skip to main content

Users get confused when a lead fails to convert, and it is because the Account has a required field that isn't required on the lead. It isn't required on the lead because leads don't have a value until ready to convert. 

Validation rules don't seem to activate on lead conversion, what can I do to enforce the field by conversion? Thanks.

 

#Sales Cloud  #Salesforce Developer  #Formulas  #Automation

3 answers
  1. Nov 4, 2023, 8:52 PM

    @Benjamin Butler you can create a trigger on account in  Before context to check the required field is present or not if it is not present it will add error to that account record, follow below approach :

     

    trigger EnforceRequiredFieldOnAccount on Account (before insert) {

        for (Account acc : Trigger.new) {

            if (acc.Required_Field__c == null) {

                acc.Required_Field__c.addError('The required field must be populated during lead conversion.');

            }

        }

    }

     

    If it helps please mark it as best answer

0/9000