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
xxyyzzxxyyzz 

Overriding New button on contact

Hi,

 

I am trying to override the new button on contacts with the following code taken from  the cookbook.

var newUrl = "{!URLFOR( $Action.Contact.NewContact, null,
        [con4_lkid= Account.Id,
         con4 = Account.Name,
         con19city = Account.BillingCity,
         con19state = Account.System_State_Code__c, 
         con19street = Account.BillingStreet,
         con19zip = Account.BillingPostalCode,
         con19country = Account.BillingCountry,
         retURL=$Request.retURL] ,true)}";
            
window.parent.location.replace(newUrl);

 The idea is to populate the Mailing State/Province field on Contact with the custom field System_State_Code__c. I think there is a Salesforce bug here as the code does not work if I leave in the lines:

 

con4_lkid= Account.Id,
con4 = Account.Name,

 If I remove these lines, the Mailing State/Province does get populated, however the Account lookup on the contact will be blank.