Deployment fails when deploying picklist fields that contain URL encoded values

Olivia: 5 days ago

I'm trying to deploy a picklist field with long string values. The current limit is 255 characters, which isn't a problem except when the string contains characters that salesforce URL encodes, in which case the Custom_Object__c.object file contains values greater than 255 characters. When deploying, Salesforce errors with Error: Picklist value is too long for the max size of 255


Salesforce will change A value, with (extra) URL encoded values to A value%2c with %28extra%29 URL encoded values which contains 6 extra characters. This obviously becomes a problem with strings that are at or close to the 255 character limit.

The solution I'm currently using is to edit the file in notepad++ using the MIME Tools > URL Decode function.

What solutions have other people used to get around this?

This has been raised as a 'known issue':

Jade: 5 days ago

Keep in mind though that in some cases you will also have to do an xml-escape after decoding url-encoded characters to avoid this error:

Error parsing file: The content of elements must consist of well-formed character data or markup.

For example, if you have this picklist value:

enter image description here

It will be retrieved in record types as:

<fullName>Not Equal %3C%3E</fullName>

URL decoding would give you:

<fullName>Not Equal <></fullName>

To deploy, you also need to xml-escape:

<fullName>Not Equal &lt;&gt;</fullName>

Although, that being said, I typically keep my picklist values very short, and if I need to display a longer value, I will set that as a translation. We have found it useful when we pull data out of salesforce or integrate with other systems, but it would help in avoiding this type of problem as well.


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="">


<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="">


<?xml version="1.0" encoding="UTF-8"?>
<CustomObjectTranslation xmlns="">
        <label><!-- Picklist --></label>
            <translation>Not Equal &lt;&gt;   and whatever else you want to put here, up to 255 characters, with xml escape characters each counting as one.</translation>