We're currently on version (8.11) of EPiServer Commerce.
Is there a way to update the Maximum Length of System MetaFields on Business Foundation Objects?
We've got quite a few fields on the Address BF Object such as Organization, Fullname, Firstname, Lastname, etc thare are being truncated at 64 characters.
Of course you can.
There are two thing you'll need to do:
- Manually adjust the columns (should be in cls_Address table)
- run this code to update the business object definition:
using (MetaClassManagerEditScope scope = DataContext.Current.MetaModel.BeginEdit(MetaClassManagerEditScope.SystemOwner, AccessLevel.System))
MetaClassManager manager = DataContext.Current.MetaModel;
MetaFieldCollection fields = DataContext.Current.MetaModel.MetaClasses[AddressEntity.ClassName].Fields;
fields["Email"].Attributes[McDataTypeAttribute.StringMaxLength] = <new length>;
fields["Name"].Attributes[McDataTypeAttribute.StringMaxLength] = <new length>;
Just make sure you back up databases and every thing before doing this.
As always, your quick replies are a lifesaver.
@Quan: Thanks for the information. Can you please tell me where to execute the above code to update the business object definition.
I am using the following
Commerce Core 10.2.2
Looking forward for your earliest response.
Thanks in advance.
@Sushant: that code should be executed once, so your best place should be in an InitializationModule
I have the same problem
This doesnt seem to work correctly. I seee that metadata is updated, however the actual sql table are not updated, and remains of original length.At that time this sinchronisattion is supposed to happen?
Maybe I need to force it somehow manualy?
Edit: I'm using Commerce 9.24.1