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
djbELLdjbELL 

Over ride "New" Lead button

Hi,
 
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.
 
<html>
<head>
<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()}";
}
</script>
</head>
<body onload="replace()">
</body>
</html>
 
Thanks,
 
DjBell
SaaniaSaania
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,
djbELLdjbELL

Hi,

 

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.

Thanks,

djb



Message Edited by djbELL on 02-25-2008 01:45 PM
SaaniaSaania
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.
djbELLdjbELL

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,

 

djb

 


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

Hi,

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 {Lead.company} instead of lea3.

How to perform that?

Thanks