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
Steve ThurstonSteve Thurston 

Override Required Field When New Record Created from Standard Page

I would like to override the required field flag when creating a new Lead.  I would like to use the Standard New Lead page, so that Users can continue to modify the page layout(s) using standard Salesforce functionality.  I would like to continue to make this field required because there are a bunch of downstream processes, both technical and business, that will fail if the field is blank.

However, I can use Apex to determine the correct value for this field at time of record creation.  I can avoid User entry error if I can set it using Apex.  But required fields must be populated in order to Save a record, so right now the User still has to enter a value, even if it's junk.  Can I:

1.  Use Apex to set a required field value
2. Leave this as a required field (not just required on the page, but a field where Required = TRUE)
3. Not force the User to enter a value for this field at time of record creation (a Lead in this case)
4. Continue to use the Standard Lead creation page rather than a custom VF page.
Ajeet28augAjeet28aug
Hi Steve,

The workaround for this is to remove the required tag from the field on the page layout that user see and then using before trigger, populating that required field with the correct value.

Thanks & Best Regards
Ajeet