2

I'm working on a SDL Tridion DXA Architecture, where I want to consume data of a published component (not linked to any page). The content structure may be in form of a key/value pair (like publish settings), but I am not allowed to use the Publish Settings because Content Editors are not allowed to edit Publish Settings. Need suggestions on how to proceed with like a DCP or a separate file like Publish Settings (if DXA allows) of any other way to read component data.

1 Answer 1

5

You can use the following:

YourModel yourModel = (YourModel)SiteConfiguration.ContentProvider.GetEntityModel(compId + "-" + tempId, WebRequestContext.Localization);

This will retrieve your component presentation and cast it to the model you have. You can put componentID and templateID in publish settings, but this way you can retrieve any DCP you want.

3
  • thanks for your reply, I'll work on same and keep you posted.
    – user2166
    Apr 9, 2022 at 17:27
  • Thanks, it works as expected.
    – user2166
    Apr 10, 2022 at 1:28
  • 1
    @user2166 - if that answer helped to fix your issue then please also upvote
    – Velmurugan
    Apr 10, 2022 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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