• Sayantan Basu

Workaround For a Known Issue In Retrofit Mode for DXA 1.7

I have already discussed about the Retrofit Mode (the new feature introduced in DXA 1.7). If you have missed that, then check this. Today I will share 1 common issue in a retrofit mode and workaround for that.

If you are planning to use Media Manager module and want to add ECL media Item into Rich text field then only you might face this problem –

 Item within a Rich Text field is not get resolved while using retrofit mode. It will show the error message – Unable to map field to property of type RichText.

Error Details –

Sdl.Web.Common.DxaException: Unable to map field ‘Content’ to property of type ‘Sdl.Web.Common.Models.RichText’. —> Sdl.Web.Common.DxaException: No semantic mapping found between Schema 33274 (uuid:9389a8ce-0f19-44ee-9eb6-2d04d0c02c25:ExternalContentLibraryStubSchemamm) and model type ‘Sdl.Web.Common.Models.MediaItem’   at Sdl.Web.Common.Mapping.SemanticSchema.GetModelTypeFromSemanticMapping(Type baseModelType)

The problem is that it only has a SemanticEntity annotation for the Core Vocabulary, but in retrofit mode, each CM Schema has its own Vocabulary. So an additional SemanticEntity annotation is needed for the MM Stub Schema. 

For more details you can check this.

As a workaround you can create a subclass and extended the default MediaManagerDistribution model. Here is the sample for that –

[SemanticEntity(CoreVocabulary, EntityName = "ExternalContentLibraryStubSchema-mm", Prefix = "a")]public class MultiMediaModel : MediaManagerDistribution{ }

Also add entry for your Model in ModuleAreaRegistration.cs like –

RegisterViewModel(typeof(MultiMediaModel));

That’s it.

#DXA17 #RetrofitMode #RichText

0 views

© 2019 by Sayantan Basu