AI OnAI Off
Hi,
Your approach looks good - we use it as well. Only one note is there is a newer version of MetaField.Create you should use. The old one has a parameter named "saveHistory" - which is no longer used - was marked as obsolete. Use this instead:
public static MetaField Create(
MetaDataContext context,
string metaNamespace,
string name,
string friendlyName,
string description,
MetaDataType dataType,
int length,
bool allowNulls,
bool multiLanguageValue,
bool allowSearch,
bool isEncrypted)
Regards,
/Q
Hi Quan,
Great thanks. We'll take that approach. And I see, the deprecated note was only for the overload with saveHistory.
Thanks again!
Hi,
We're currently on version (8.11) of EPiServer Commerce.
What's the recommended way to create a meta field for a MetaDataPlus MetaClass in EPiServer Commerce? We've got a few custom fields that we'd like to add onto the OrderForm Metaclass. Of course I know how to do this through Commerce Manager but we'd like to set up any custom metafields in an initialisation module so that an admin doesn't need to set everything up manually.
I've been unable to find any real solid examples online.
In the past, this is how I've done it, but it feels a bit hacky and I've noticed there's a deprecated note next to the MetaField.Create method.
1. Check the Metafield doesn't already exist.
2. Create Metafield using Mediachase.MetaDataPlus.Configurator.MetaField.Create
3. Associate with MetaClass using Mediachase.MetaDataPlus.Configurator.MetaClass.AddField
Is there a recommended way to do this or EPi simply suggests to only do it manually?
Thanks