Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Commerce Manager: Creating a dropdown property in Contacts

Vote:
 

Preferably I would like to create a dictionary dropdown property, customizable by the editor like Customer Group (see screenshot below) in the Contact edit view.

Customer Group property

I've been able to create and display a string property by adding a row in Contact.[MC_BaseForm].xml with Control source="MyProperty" and initializing it in App_Start:

var customerMetadata = DataContext.Current.MetaModel.MetaClasses.Cast().First(mc => mc.Name == "Contact");

customerMetadata.CreateMetaField(
                    "MyProperty",
                    "My Property",
                    MetaFieldType.Text,
                    null);

Am I doing this correctly so far? How would I go about changing this property (or creating a new one) to display it as a dropdown?

Versions in Commerce Manager project: 

<>package id="EPiServer.CMS.Core" version="8.4.0" targetFramework="net451" />
<>package id="EPiServer.Commerce.Core" version="8.11.5" targetFramework="net451" />
<>package id="EPiServer.CommerceManager" version="8.9.0" targetFramework="net451" />
<>package id="EPiServer.Framework" version="8.4.0" targetFramework="net451" />

Thank you in advance.

#154837
Edited, Aug 31, 2016 9:27
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.