Try our conversational search powered by Generative AI!

Extending Maximum Length of System Metafields on Business Foundation Objects



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.



Sep 03, 2015 9:19

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>;
//other fields

Just make sure you back up databases and every thing before doing this.



Sep 03, 2015 12:24


As always, your quick replies are a lifesaver.


Sep 03, 2015 23:59

@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 

Episerver Version

Commerce 10.2.2

Commerce Core 10.2.2

Commerce.UI 10.2.2

Looking forward for your earliest response. 

Thanks in advance.

Mar 03, 2017 8:35

@Sushant: that code should be executed once, so your best place should be in an InitializationModule 

Mar 03, 2017 8:42

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



Edited, May 18, 2017 11:37
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.