Convert Selection field to Multiselect

By | August 13, 2010

It seems to be pretty straight forward task that can be done directly at database level, but do I really need to go at CRM database level to fire the queries and take risk with the metadata? Absolutely not!!

I had custom entity named Project wherein I added a selection field named proj_assignedgroup to understand the group associated with each project. This was supposed to be a simple selection field wherein I can select only one value at a time. The business logic changed and then they decided that there may be more than one groups associated with project, though the selection options would remain the same. Well, I would have done it quite easily by adding new multiselect field, but didn’t want to disturb screens, lists and views already using the previous field so I decided to change the existing selection field to Multiselect field.

I went to opportunity entity o n my practice CRM edition, started component recording and created new Multiselect field named oppo_assignedgroup.

The component recording done was as below.

///////script – component recording

FamilyType=’Tags’;
Family=’ColNames’;
Code=’ oppo_assignedgroup’;
Captions[‘US’]=’Assigned Group’;
AddCaption();

AddColumn(‘Opportunity’,’ oppo_assignedgroup’,’10’,'(255)’,’true’,’false’);
var EditsId12203 = AddCustom_Edits(‘Opportunity’, oppo_assignedgroup’,’28’,’0′,”,’4′,’oppo_assignedgroup’,”,”,”,”);
AddCustom_Data(‘Custom_Edits’, ‘ColP’, ‘ColP_ColPropsId’,’ColP_ColPropsId, ColP_DataType, ColP_DataSize’, EditsId12203+’,”4″,”255″‘,’1’);
AddCustom_Data(‘Custom_Edits’,’ColP’,’ColP_ColPropsId’,’ColP_ColPropsId,ColP_TiedFields’,EditsId12203+’,”,”‘,’1’);
AddCustom_Data(‘Custom_Edits’,’ColP’,’ColP_ColPropsId’,’ColP_ColPropsId,ColP_SSViewField’,EditsId12203+’,”,”‘,’1’);

///////End of script – component recording

Just replaced the Opportunity entity in script by Project and all the occurrences of oppo_assignedgroup by proj_assignedgroup.

Added this new to script and ran it on CRM with project entity. Wholla!!!! I can now see my field converted to multiselect field wherever I have used it. How simple!!

For queries regarding the functionality and cost of this component, please feel free to drop us an email at crm@greytrix.com.