13

Based on all evidence gathered there is a major bug in Spring '17 involving Custom Metadata Types and picklist values: what SOQL returns is different than what's saved in the database.

To reenact:

  • go to a sandbox org (where Spring '17 has been activated)
  • create a Custom Metadata Type, and add a picklist field with these values:
    • 1
    • 1 or more
    • 2
  • add a new entry and put "1 or more" for the picklist value
  • open up Developer Console, then run a query against the Custom Metadata Type:
    • SELECT MyPicklist__c FROM MyCMT__mdt
    • you will notice the value "2" is returned instead of "1 or more"

Take a look here:

enter image description here

Has anyone else noticed this?

  • Do you mean to say, you are filtering by 1 or more in query and still getting 2? – Ashwani Jan 10 '17 at 4:31
  • @Ashwani yes. The outcome is the same if I don't have any filters in the query. – Mossi Jan 10 '17 at 4:35
  • You do not need to run any query. If we can create a view with all columns it can be noticed – Santanu Boral Jan 10 '17 at 4:40
  • In my case, view itself showing wrong value. I have created a view taking all columns of custom meta data types, it is not taking "1 or more" instead taking 2 – Santanu Boral Jan 10 '17 at 4:44
  • 1
    We're looking into this now. – Avrom Roy-Faderman Jan 10 '17 at 18:57
13

You can track this bug at https://success.salesforce.com/issues_view?id=a1p3A000000eshdQAA

It's scheduled to be fixed in the next patch release.

We've identified the exact set of circumstances that cause this to appear. Suppose you have n picklist values. If one of those picklist values is a number m < n, and that value is not the m th value created, you will see this bug when you try to query for the m th value.

For example: The picklist with values "2", "a" will hit this bug (if you create these values as part of creating the picklist), because the *1*st picklist value is 2. "1", "a" wouldn't have this problem; nor would "a", "2".

In your specific case, it's that the value of the 3rd picklist item is "2", and 3 != 2.

So, while we still regard this as a critical bug for us to fix, it won't impact every picklist.

  • 3
    Glad to see the people who are working on this stuff monitoring this forum. – Adrian Larson Jan 12 '17 at 20:28
  • We try. It's not the best way to reach us (probably a case is), but I'm on top of it as much as I can be. – Avrom Roy-Faderman Jan 12 '17 at 20:30
  • Indeed. The more channels the better. A lot of folks that surface problems on these forums don't have the ability to open a case, though. It goes both ways and you guys are doing a great job. – Adrian Larson Jan 12 '17 at 20:34
  • +1 Thanks for explaining the reason. It sounds like, it is affect the alphabets as well? I will have to check my 39 custom metadata types ;( – Ashwani Jan 12 '17 at 20:34
  • 1
    It only affects picklists containing entries that are just numbers. The affected entry may be alphabetical, but if you have no numeric entries in a picklist you should be safe. Please let us know if that still causes problems for you; if it does it's a separate issue. – Avrom Roy-Faderman Jan 12 '17 at 20:57

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.