When there is a need of converting local to global optionSet we can use https://xrmoptionsetconverter.codeplex.com/. Everything works fine until this customization needs to be exported to another environment on which local optionSet is already declared and filled with data.
While importing customization error occures: OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId(xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) != xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;
How does the tool really works?
Basically it takes local optionSet, creates its temporary copy to which all current data, views, forms are beeing copied. Local optionSet is being deleted. Then destination global optionSet is being created and new local option set with same name are original is created and all data is being copied back.
There is always some “but”.
First of all when tool creates new attribue CRM WCF creates not only new AttributeId but also new ColumnNumber (it is used in audit). Despite new local optionSet (which indicates to global optionSet) has same schema name it is treated as completely new attribute. Also audit mechanism doesn’t know what to do with new fields – so it throws exception while exploring.
Another option is to:
1. Create global optionSet at eg. DEV environment and export it to LIVE/STAGE/TEST
2. Find it’s quid and
3. UPDATE Attribute SET OptionSetId = ‘NewGlobalOptionSetGUID’ WHERE AttributeId = ‘LocalOptionSetGUID’
This operation provides all data specified in audit because ColumnNumber has not changed 🙂