November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Please refer here http://webhelp.episerver.com/latest/commerce/system-administration/order-meta-classes-fields.htm. You will want to create a new meta field and then associate that field with OrderAddressEx meta class
Thanks mark.
I am adding the customer management->organization -> address via code.
How to assign the values to that custom properties and retrive that also.please help me out.
I am Adding an Customer addresses like below,
Organization org = CustomerContext.Current.GetOrganizationById(orgkey);
var address= CustomerAddress.CreateInstance();
address.AddressType = CustomerAddressTypeEnum.Shipping;
.
.
address.RegionCode = wlcOrganizationAddress.AccountId;
address.OrganizationId = org.PrimaryKeyId;
BusinessManager.Create(address);
address["FieldName"] = value; var value = (string)address["FieldName"] var value = address.GetStringValue("FieldName");
Thank you Mark,
Already i tried this code.If i use this "address["FieldName"] = value;" the custom property value is added into Extended properties but i dont think the value saved into database.If i tried to retrive the value is empty only.
Hi Erik,
I have saved using this funtion "BusinessManager.Create(address);" all the other default properties are saved only the custom properties not saved.
Can you check if DefaultMetaObjectFactory.CanCreate returns true for your metaclass?
Also do try and create it first, then add you custom properties and save it again.
Default properties isn't stored in the same array and it is even stored on a base class so it isn't the same code that handles them.
Hi Erik,
Thank you.
I made one mistake in adding meta field for address.so now i added meta field using code and saved my custom property like above code (#184489).
private void SetupMetaField()
{
MetaClassManager metaModel = DataContext.Current.MetaModel;
foreach (MetaClass metaclasses in metaModel.MetaClasses)
{
if (metaclasses.Name == "Address")
{
string fieldName = "meta field name";
if (metaclasses.Fields[fieldName] == null)
{
AttributeCollection attr = new AttributeCollection();
MetaField newMetafield = metaclasses.CreateMetaField(
fieldName,
"meta field name",
MetaFieldType.Text,
true,
string.Empty,
attr);
}
break;
}
}
}
if there any way to add meta field to customer management address using commerce backend.
please inform me.
commerce backend as in the commerce manager administration UI?
Commerce->Commerce Manager->Administration->System settings->Business Foundation
The "Address" object contains the definitions for all those meta fields, if it can be done it is there.
On a side note your above code is more complex than needed, to retrieve and create a field on address you can do something similar to this:
var metaClass = DataContext.Current.GetMetaClass("Address"); using (var myMetaBuilder = new MetaFieldBuilder(metaClass)) { myMetaBuilder.MetaClass.AccessLevel = AccessLevel.Customization; myMetaBuilder.CreateText("meta field name", "meta field friendly name", true, 256, false); myMetaBuilder.SaveChanges(); }
How to add custom property in organization addresses?Any one please help me out?
i want add one new property in addresses.