How to query related data through API

Posted by Community Admin on 04-Aug-2018 20:07

How to query related data through API

All Replies

Posted by Community Admin on 26-May-2014 00:00

I have 2 dynamic modules that I created in Sitefinity 7 using the dynamic module builder- movies and actors. These dynamic types are related through module builders "RelatedData" field.

A "Movie (Dynamic Type)" has a "Related Data" field to the "Actors (Dynamic Type)".  I also have a number of other related data types for a movie.

I am building an MVC widget that needs to display the related "Actor (Dynamic Type)" actors for the specified "Movie" page that the user is on.

How can I retrieve the related "Actors" for the movie? I would like to do this programatically with c# code.  I am not familiar with how to use  the "RelatedDataService" via the REST services.

A code sample would be helpful. I've already read www.sitefinity.com/documentationarticles/related-data-field.

Posted by Community Admin on 27-May-2014 00:00

Hello Aaron,

We have answered you with details in the support ticket.
You can query the related data items, which are items built with the module builder, as well this way:

movie.GetRelatedItems<DynamicContent>("Actors");
Then you can use GetValue() method to get the values of each of the properties for every item in the above returned collection:
actor.GetValue("Title").ToString();


Regards,
Nikola Zagorchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed