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

Overriding New button

Hi All,
I have a requirement in which On clicking the New button on the Account page,it should display a New page with 2 fields prepopulated.
Of these,one is a custom field and the other is a standard field.I am able to prepopulate the standard field.But when i try to populate the custom field in the same manner,i get error.
window.parent.location.href="{!URLFOR($Action.Account.New, null,  [retURL="/001/o",zsalesorg__c="PTAA",acc2 = "vin"],true)}";
Could anyone help me to solve this?
Thanks in advance,

Hi, where did you get the "zsalesorg__c=" part from?  I think you assumed that the field name of the HTML input element for your custom field would be the same as the actual field name.  It isn't.

Log into Salesforce, and Edit an existing Account.  Then do a "View Source" using your browser (or some tool that allows you to examine the HTML of the edit page).  Look for the HTML <input> tag for the field you want to pre-load and get the id string for that element.  Something like:

<td class="labelCol">
<label for="00N30000000t6EN">SLA Serial Number</label>
<td class="dataCol">
<input id="00N30000000t6EN" maxlength="10" name="00N30000000t6EN" size="20" tabindex="31" type="text">

Then use    ... retUTL="/001/o",00N30000000t6EN="PTAA", acc2="vin" ...

Best, Steve.
Hi Steve,
Thanks a lot for the reply.
I have checked the source code of the Account page and have found that the field name for my custom field is "00N60000001XrGt".
So i replaced it in the code as
window.parent.location.href="{!URLFOR($Action.Account.New, null,  [retURL="/001/o",00N60000001XrGt="PTAA",acc2 = "vin"],true)}";
But i get an error that the field is 00N60000001XrGt is not defined.
Did you ever resolve this, I am getting the same problem.