Tuesday, June 9, 2020

Invalid Argument. : System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

Recently I came across this issue while importing solutions from Dev to Prod (Importing UCI changes from Dev to Prod)

The solution failed with same error: Specified argument was out of the range of valid values. Parameter name: Default picklist value has to be one of the option values.

I have thoroughly went through all my optionssets and found the below useful information

Error : Invalid Argument. : System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: Picklist option with value (864630000) that has the parent OptionSet with (guid) id does not exist. Default picklist value has to be one of the option values.

To find the offending option set I took the Option Value {864630000} and looked for that value within the customizations.xml file

the value should be under <attribute> tag on xml where the type is picklist(<Type>picklist</Type>), under <attribute> tag you will find <AppDefaultValue> tag which stored the default picklist value, check if the default value is part of the optionset value or not. If not add a value with 864630000 under the mentioned option set --> Save --> re-import the solution

Ex: in my scenario I have searched for  <AppDefaultValue>864630000</AppDefaultValue> from this grab the Picklist Attribute, check if that attribute has 864630000 value

Another way is you can change the default value to other existing value in customizations.xml or change the value in CRM  to unassigned value --> Save --> Publish.

it will make easier if you know the entity that trigger the error, you just need to check on that entity scope <Entity></Entity>..

Hope this will help you in finding the wrong picklist value using AppDefaultValue..

No comments:

Post a Comment