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:
Has anyone else noticed this?
Answer
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.
Attribution
Source : Link , Question Author : Mossi , Answer Author : Avrom Roy-Faderman