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
sg88324sg88324 

problem with onclick javascript

Hi All,

 

Please find the following onclick code:

 

window.open("https://cs2.salesforce.com/setup/ui/recordtypeselect.jsp?ent=01IA0000000osrS&retURL=%2F{!GE_Installed_Base__c.Id}&save_new_url=%2Fa06%2Fe%3FCF00NR0000000oKiF%3D{!GE_Installed_Base__c.Name}%26CF00NR0000000oKiF_lkid%3D{!GE_Installed_Base__c.Id}%26CF00NA0000002R42U%3D{!Account.Name}%26CF00NA0000002R42U_lkid%3D{!Account.Id}%26retURL%3D%2F{!GE_Installed_Base__c.Id}");

 

This code is to pre-populate account lookup. The highlighted merge field account name is creating problems. If the account name has an "&" symbol, for example, "P P & Montane",  the account name is being passed in the URL as "P + P". so there is a "Multiple list values error" on the page for the account lookup field.

 

Can anyone give me a solution for this? i tried URLENCODE and SUBSTITUTE functions. but in vain.

 

Thanks,

Sandeep

 

 

ram_iyerram_iyer
If you are trying to populate an Account lookup field, you should try passing the Account ID instead of the name. That would avoid issues with having to encode the URL
sg88324sg88324
Account ID doesnt wrk here. lookup consists of 2 parts, name and id.. so we have to pass both the things to prepopulate a lookup field