+ Start a Discussion
communitycommunity 

Merge fields Issue

Created a new custom button of type URL and am passing values into it using merge fields.

 

Everything is fine but when the {!Opportunity.Name} contains "&", the URL breaks!

 

 

/setup/ui/recordtypeselect.jsp?ent=01I200000007SWS&retURL=%2F{!Opportunity.Id}&Name=Auto+Number&
save_new_url=%2Fa1l%2Fe%3FCF00N20000002o7Kh%3D{!Opportunity.Name}
%26CF00N20000002o7Kh_lkid%3D{!Opportunity.Id}%26retURL%3D%252F{!Opportunity.Id}&
CF00N20000002oGth={!Opportunity.Account}&CF00N20000002oGth_lkid={!Opportunity.AccountId}

 

 
 

How do I stop the URL break ,if the name contains '&' ?

 

Help!

 

Best Answer chosen by Admin (Salesforce Developers) 
communitycommunity

Yeah!  Just figured it out that

 

{!URLENCODE(Opportunity.Name)}

 

is working.

 

Thanks Steve.

All Answers

Ankit AroraAnkit Arora

Have you tried passing your value using JSENCODE ???

 

{!JSENCODE(Opportunity.Name)}

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

communitycommunity

Hi Ankit, thanks for the reply. 

 

But the JSENCODE didn't work though! 

SteveBowerSteveBower

URLENCODE()

communitycommunity

Yeah!  Just figured it out that

 

{!URLENCODE(Opportunity.Name)}

 

is working.

 

Thanks Steve.

This was selected as the best answer
Ankit AroraAnkit Arora

My bad, I have written JSENCODE instead of URLENCODE.

Anyways great that you have the solution.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page