4

While trying to retrieve Content using dynamic component presentation, the KeywordModelData returns only the ID and other values are missing. For the field "name" as shown below. The same question exists for Java but i need a solution for .Net, is there any alternate model service code available to get complete KeywordModelData. Thanks in advance.

Content":{ "name":{"$type":"KeywordModelData","Id":"1455"}, "title":"Efficiency", "text":{"$type":"RichTextData","Fragments":["Rich Text Data from Comp"]}, "filterType":"CheckBox"}

enter image description here

private EntityModelData CreateEntityModelData(ComponentPresentation componentPresentation, Localization localization)
    {
        EntityModelData entityModelData = SiteConfiguration.ModelServiceProvider.GetEntityModelData(componentPresentation.ComponentId + "-" + componentPresentation.ComponentTemplateId, localization);
        ContentModelData componentContent = entityModelData.Content;
        ContentModelData componentMetadata = entityModelData.Metadata;
        return new EntityModelData
        {
            Id = componentPresentation.ComponentId.ToString(),
            SchemaId = entityModelData.SchemaId.ToString(),
            Metadata = componentMetadata,
            Content = componentContent
        };
    }
1
  • BTW: you should not use the ModelServiceProvider directly in application code; use the ContentProvider instead (it provides caching and semantic mapping functionality). Commented Nov 16, 2018 at 8:16

1 Answer 1

5

This is a defect in the DXA 2.0 Model Service, which has already been hotfixed. See https://github.com/sdl/dxa-model-service/commit/77c2043ba690ae15f3efee9c3f598cb7bd79a4e8

Contact SDL Customer Support to receive this hotfix.

3
  • Thanks Rick. The above hotfix is for java and we have a .net application. We have contacted customer service and they will be working on a .net equivalent fix and update us. Thanks for your input.
    – GJin
    Commented Nov 19, 2018 at 20:14
  • 1
    The hotfix is for the Model Service, which is implemented in Java only; even if you have a .NET Web Application, your Model Service will be Java. Commented Nov 19, 2018 at 20:44
  • Thanks Rick. We received the Hotfix from SDL Customer Support and the issue is fixed after applying the hotfix. Thanks for your input we were able to fix the issue.
    – SRajeshK
    Commented Nov 27, 2018 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.