3

I have custom picklist field (Alpha_Type__c) with the following sorts of values:

Option:

A B C - XY the api name for this is: a_b_c_x_y

A B C D the api name for this is: a_b_c_d

A B C \ DEthe api name for this is: a_b_c_d_e

Anyway I use this field in workflow rule to update another field. The formula is simple enough:

RecordType.Name + " Request - " + TEXT(Alpha_Type__c )

Whenever it runs it always uses the Picklist API name in the field update presenting the result as:

Volunteers Request - a_b_c_x_y

When in reality I want it to display the value as:

Volunteers Request - A B C - XY

Has anyone come across this before? I've read the picklist API names were released in Spring 2017 so could it be a bug?

Thanks

EDIT with some images, apologies these relate to vandalism on green spaces - I didn't want to go into detail above but I can't avoid it with it screenshots....first the picklist: Picklist Image

And now the formula in the Field Update: Formula

And finally the end result, subject field populated by the formula via a workflow rule: subject

I have tried using new values in the picklist and I have tried a different picklist field and again the formula displayed the api name (It is perhaps more noticeable now the api names have underscores etc - in the past (and presumably after the upgrade they value reflected the api name identically...)

  • This doesn't make sense to me. I have formulas in my org that use the TEXT function and get the value exactly how I would expect, instead of the API name. Are you sure the values in the picklist are different from the API names? – Renato Oliveira Feb 18 '17 at 12:33
  • 1
    Hi, Ive double checked. In the picklist it displays the value as I expect - I then save the record and I can see the formula field next to the picklist and it is still displaying the api name......The api name was edited to underscores as it had slashes in originally...but that shouldn't matter...i've recreated the formula and it still does it.... – n34_panda Feb 18 '17 at 13:16
  • Very strange. Can you add screenshots? Is this picklist using a global value set? – gorav Feb 18 '17 at 15:49
  • No problem - I have edited the initial post - no they aren't using a global value set (it maybe something we are going to try if nobody can think of anything) - I have tried replacing both the value/api and I am about to try it on another picklist...will put the info in the initial post. – n34_panda Feb 18 '17 at 16:25
  • Did some testing and confirmed I'm seeing the same behavior, and it makes no sense at all. The one thing I found is that you can leave the API name alone while adjusting the label and it will not throw an error, even if there are spaces in it. – gorav Feb 19 '17 at 20:35
1

So I have found a workaround...with help from Salesforce:

  • Under "Data Management" -> "Picklist Settings" enable the sole setting of "Disable editing picklist values' API names"
  • Go to your picklist field and delete the entry
  • Add the value back into the picklist

By default the API Name is an exact copy of the Value, it includes spaces, special characters etc.

By enabling the first setting I can avoid encountering this problem by stopping the developers playing with the API names...

0

Seriously odd stuff. Unless someone else has an idea, I'd say it's a bug related to this spring17 picklist enhancement where picklist labels are no longer tied to API names (just noticed that you flagged that feature in your post!)

Specifically this bit:

The label is displayed in a picklist field on a record, and the API name is used everywhere else. For example, data import and export and Apex code use the API name.

Maybe they got a bit carried away with 'everything else'

And here is another interesting and wacky development. I was editing an existing picklist value and noticed the default API name that was created for this picklist has SPACES! If I tried to change the API name, it would throw an error, but if i just changed the label it would let me save it w/ the API name w/ spaces.

Existing picklist w auto-generated API Name w Spaces

default api name w spaces

Edited Label and was able to save

saved w new label and same api name

Save Fails when editing API name and leaving spaces

editing api name fails

Umm. Not sure what this means other than some serious half-baking going on. Maybe thats why they didnt detect the error in their tests...they didnt create the default api names correctly...

update - tested and confirmed seeing same behavior

looks like the default API name created when adding a picklist value contains spaces - not just the ones created when spring17 rolled out.

And I've confirmed that any formula field referencing the picklist will display the API name, not the label. So as of now, only option is to not edit api name - leave it as default, and just tweak the labels. Thats not much of a solution b/c formula fields will display the API name, not the label!!

  • Thanks for all this - I was going crazy. I also saw some of the api names that were created automatically had spaces - some of ours have slashes in too (the original api name in the example above....) I'll speak to Salesforce1 tomorrow and copy in any reply I get – n34_panda Feb 19 '17 at 21:02
  • I got a reply - see my answer - it worked for me and resolves my issue. – n34_panda Feb 22 '17 at 12:31
0

I chased this one pretty extensively in the past couple weeks. What I came up with is:

1) Picklist API Names for existing values/labels are not immediately translated when the org is upgraded to Spring '17. What this means is that my previous picklist values that were "Test Value" still had a value of "Test Value" and a label of "Test Value", until of course I tried mucking with it in the setup UI.

2) There is validation currently built into the UI currently that enforces underscores instead of spaces. This thread suggests that this validation is going away on 2/23: https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000009PDt&fId=0D53A00002zt1z0 . Once this validation goes away I think you should to get back to status quo behavior if you wanted to, ie. just match the label to the value. It sounds like if you need to fix this prior to this fix, you can just deploy the API name via the metadata api (as it's just a UI enforcement of the api name validation). I have not tested a metadata deploy with picklist values with spaces though.

3) There's a lot of spots that this will hit. I gave my customizations a once over and here's an example of a current gap: https://success.salesforce.com/ideaView?id=08730000000kn4lAAA .

  • Thanks for all that info - i've got a case open with Salesforce but presumably they'll confirm that the validation will be disabled on the 23rd and we can get on with things - i'll reply back when I can. – n34_panda Feb 20 '17 at 19:05
  • I've added an answer above - Salesforce provided a workaround that is pretty straight-forward if a bit silly. It works for me anyway. – n34_panda Feb 22 '17 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.