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

Over ride "New" Lead button

I am trying to set up an S-control to over-ride the "New" Lead button so that it will auto populate the Company field with a predetermined value (in this case with current time/date).  This is the latest attempt but I just can not get the value to be inserted.  Any help would be much appreciated.
<script src="/soap/ajax/9.0/connection.js"></script>
<script language="Javascript">
function replace()
parent.document.location.href= "/00Q/e?nooverride=1{!Lead.Compant}={!NOW()}";
<body onload="replace()">
Dont know the technical details, but you have spelt Company wrong in the code snippet.

parent.document.location.href= "/00Q/e?nooverride=1{!Lead.Compant}={!NOW()}";




Thanks for taking a look.  That was just a type-o when writing my message.  I reviewed the code and it is written correctly in my S-control.  Just to give you some more information, I have a product support team that will be manually entering Leads but most of the Leads will be people who do not necessarily belong to a company so I want to auto-populate "Company" with the date when the product support  rep. clicks the New button.  The "Company" field is required in Leads and I want to simplify the process for the intake team.   I don't have  a lot of programming experience but I imagine this should be possible.  I know I'm close but not close enough.



Message Edited by djbELL on 02-25-2008 01:45 PM
In that case, simply do a field update.

Go to:

Setup -> Create -> Workflow and Approvals -> Field Update

Create a new field update, select 'Leads' as the object and 'Company' as the field. In the formula field just write "No Company" (in double quotes) and Save.

Then create a workflow rule by going to

Setup -> Create -> Workflow and Approvals -> Workflow rules

Just give a name to the rule and select 'Lead' object. for the 'criteria are met' option, select Lead: Company, then 'equals' and then leave it blank (to show that when the company name is null). Click 'Save and Next' and then add then 'Add Workflow Action' add the  Field Update you created earlier.

I think this setup will work for you.

Thanks Again Saania,


Unfortuantely workflow rules/updates kick in after the required fields are reviewed.  When I click save I will get an error saying i need to supply a value befor saving.  Hence the need to populate the company field upon clicking the new button and not the save button. 

Thanks for the imput though,




The following code works -
window.parent.location.href = "/00Q/e?retURL=%2F00Q%2Fo&lea3={!NOW()}&nooverride=1"
Here 'lea3' is the id of the company field which you can get by clicking on the view source.
Thanks for your input.  I tried out the code and it does work.
much appreciated,


I need something similar, but I would like to populate also future custom fields.

Thus, doing 'view source' is not appropriate for me. I need to get dynamically the fields id-s.

For example, I would send {} instead of lea3.

How to perform that?