Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Loading ProductContent throws and error because MetaField value is too long...?

Vote:
 

Hi all,

I have a metafield of type "Short String" - in the database I see it has max length of 512. 

So, we have imported data into this metafield which is 512 characters long.

But when I use IContentLoader to load a product containing that metafield, it is mapped to an EPiServer.Core.PropertyString which has a max length of 255... so, this exception is thrown:

Message: EPiServer.Core.InvalidPropertyValueException: "TechArticleLinks" has exceeded its limit of 255 characters.

   at EPiServer.Core.PropertyString.set_String(String value)

   at EPiServer.Core.PropertyData.SetPropertyValue(Object value, SetPropertyValueDelegate doSet)

   at EPiServer.Commerce.Catalog.Provider.MetaDataPropertyMapper.AssignMetaFieldValueToProperty(PropertyData property, Object metaFieldValue, MetaDataType metaDataType, String blockPropertyMetaFieldName)

   at EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.AddMetaDataAttributePropertyValues(MetaObjectAccessor accessor, CatalogContentBase content)

   at EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadProperties(CatalogEntryRow entryRow, CatalogItemSeoRow seoRow, VariationRow variationRow, EntryContentBase content, MetaObjectAccessor metaObjectAccessor)

   at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.ConstructEntries(CatalogEntryDto entryDto, IDictionary`2 versionsForUnpublishedContent, IList`1 entryNodeRelations, String language)

How can I avoid this error?  Is a "short string" metafield actually capable of using up to 512 characters?  Or can it only use 255?

Thanks,

 - Ken

#182969
Edited, Oct 02, 2017 18:47
Vote:
 

Shouldn't you use PropertyLongString? It is now recommended over PropertyString even for short strings ...

#182983
Oct 03, 2017 0:05
* 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.