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
goosegoose 

Autopopulate the required company field on a new lead

Hi,

I've been running around in circles a bit on this one.

What I would like to do is set the company field (required) on a new lead to be the lead's lastname+firstname if it is not entered.

I first tried using a before insert trigger but it failed on validation of the field not being empty - so it looks as if the required field validations of non-custom fields are run before triggers.

Next I found this code suggestion:

http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=7009

which bascailly says on bringing up the new lead forn, auto-populate the required field with some predetermined text that can be substituted out in the before insert trigger.

And so I overrode the new button for leads with the suggested s-control to generate the URL:

https://na6.salesforce.com/00Q/e?retURL=%2F00Q%2Fo&Company=test&nooverride=1

But the Company field is still blank rather than 'test'.

Is this because you cannot pass parameters to non-custom forms or have I done something wrong?

Any suggestions welcome.

Thanks