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
Hemanth BakthavatsaluHemanth Bakthavatsalu 

URLEncode not working on a picklist field in Javascript

I have created a custom button using Javascript on Opportunity. On the opportunity object we already have relationship field which relates back to Opportunity (like Parent-Child).

The javascript button will copy the values of certain field from the Parent opportunity and auto populate in the new child opportunity created. All the values are copied to child opportunity, but except for picklist values which has "&" in the value.. When i use urlencode like below, it is throwing the below error:

00NK0000001jyxH={!URLENCODE(Opportunity.ABC__c)}

Error: Field Opportunity.HBS_ePSF_Branch_Location__c is a picklist field. Picklist fields are only supported in certain functions.
 
Best Answer chosen by Hemanth Bakthavatsalu
Nish321Nish321
Try this :   
00NK0000001jyxH={!URLENCODE(TEXT(Opportunity.ABC__c))}

All Answers

Nish321Nish321
Try this :   
00NK0000001jyxH={!URLENCODE(TEXT(Opportunity.ABC__c))}
This was selected as the best answer
Hemanth BakthavatsaluHemanth Bakthavatsalu
Thanks It worked..