+ Start a Discussion
Wes Cooper.ax1560Wes Cooper.ax1560 

Custom Button URL Question

We have a custom object with a custom "Create New Case" button on it. When a user clicks the "Create New Case" button, the user is taken to a Record Type screen. The user then needs to select a Record Type, click next and then the case fields are populated with specific information from the custom object.

 

For 98% of the custom objects, this works, however we have run into problems where the wrong record type is populated in the new case even though the correct record type was selected. 

 

In our Sandbox, we were having a lot of trouble recreating the problem. No matter what we did, everything worked properly, until I created an Account with an "&" in the name. For example, I created an account called WesCooper & Sons Inc. From the custom object, which has WesCooper & Sons Inc as the Account, I proceeded to click the "Create New Case" button, and this is where it fails. The wrong Record Type is inserted into the case just like in the production environment. I tested further by removing the "&" and replacing it with just a "N". After doing this, the case was created with the correct information.

 

Does anyone have any suggestions as to why this may be happening and what a possible solution could be?

 

Thank you,

Adil_SFDCAdil_SFDC

In u r code write a logic which can replace & or special chars

or best is to use EncodinguTIL.uRL ENCODE(aCCOUNT FIELD,'UTF-8);'

Wes Cooper.ax1560Wes Cooper.ax1560

Thanks for the reply. People posted to another thread to use the SUBSTITUE or URLENCODE functions. I tried both of these, and they both worked, but in an unexpected fashion. When the Case opens, the right information is posted, but in the Account field, the Account ID is posted, not the Account Name. If I remove the SUBSTITUE or URLENCODE functions, the Account name displays fine, but only for account names without an "&" in them. My URL is below.

 

/setup/ui/recordtypeselect.jsp?ent=01IC0000000eUtt&retURL=%2F{!Opportunity.Id}&save_new_url=%2Fa0g%2Fe%3FCF00NC0000004Nnw2%3D{!SUBSTITUTE(Opportunity.Name, "&", "%26")}%26CF00NC0000004Nnw2_lkid%3D{!Opportunity.Id}%26retURL%3D%252F{!Opportunity.Id}%26CF00NC0000004Nnvo%3D{!SUBSTITUTE(Opportunity.Account, "&", "%26")}%26CF00NC0000004Nnvo_lkid%3D{!Opportunity.AccountId}

 

Am I writing the URL wrong?

Wes Cooper.ax1560Wes Cooper.ax1560

Any suggestions for my problem?