I want to prepopulate the Company field in the Lead object.

The idea here is that I don't want a Company Name in my Leads ie the Account object is not necessary for me. Now, as you know the company name is a standard required field so it cannot be removed and it cannot be renamed, so, I want it to be automatically populate it to say, XYZ.

To achieve this, I have tried using workflow but the user will have to write some gibberish for the record to save and then modify it. The same goes for flow.

I have also tried using before trigger but the validation runs before the trigger, so it gives an error if the company field is left blank.

I have also tried using redirecting the New Lead button to a custom VF page and that does seem to work but only on Salesforce classic. See here

<apex:page standardController="Lead" 

I don't have enough knowledge of LWC but I think that this might be achievable using the same if I redirect the New Lead button to the component. Can you guys help me with that?

Or is there any other way I can go about it? Maybe using the URL parameters. Any help is welcome. :)

New contributor
sauhardnc is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2 Answers 2


If you Enable Person Accounts, the Company field is no longer required, and you can even remove it from the page entirely. Note that there are some considerations to be aware of, so try this in a Sandbox first.


As per Triggers & Order of Execution, if the record is being created from standard UI, then the required field defined at page layout or field definition are evaluated first. So, before trigger (apex or flow based) won't help you out.

You can create a LWC using lightning-record-edit-form [Note that the sample codes are provided in the same page]. Also, you cannot use lightning-record-form because it doesn't support pre-populating the fields. After you have created this LWC, you can override the New button to use this LWC from the object settings page (see screenshot below) . Under Lightning Experience Override, you would be able to see the LWC name in the drop down.

enter image description here

Your Answer

sauhardnc is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.