bcolpaert / Colso.Xrm.AttributeEditor

XrmToolbox plugin to create, modify and delete entity attributes via an Excel template.
MIT License
8 stars 12 forks source link

Error creating new option set attribute in Dynamics 365 v9 #13

Open AndyGray-k3 opened 6 years ago

AndyGray-k3 commented 6 years ago

Hi

I'm getting an error trying to create a new option set field in Dynamics 365 Version 1612 (9.0.2438). The template was created from a Dynamics CRM 2013 system.

It has correctly identified the fields that need to be updated & created and successfully created a lookup field.

When it gets to the option set field, it gives the error

"Option set display name description is null or empty for objectid: 00000000-0000-0000-0000-000000000000. objectcolumn: DisplayName and language: 1033".

This is a non-global option set with 9 values.

Kind regards Andy

AndyGray-k3 commented 6 years ago

This is caused by the code in PicklistAttribute.cs that sets up the OptionSetMetadata.DisplayName.

If it is not a global option set, it is setting it to null. Don't know if it is a change in v9 but the DisplayName must be populated.

attribute.OptionSet = new OptionSetMetadata(optionCollection) { IsGlobal = globalNames != null, Name = globalNames?[0], DisplayName = new Label(globalNames?[1], LanguageCode), OptionSetType = OptionSetType.Picklist, };

mkmk89 commented 4 years ago

I fixed it in my fork and submitted pull request #19 to merge the fix in