I've set up two Dynamic Content Modules and successfully linked one to the other in the backend. The problem I am having is that I am trying to query the values of one from the other. The example is as follows:
Module One: Business Area -> Business Unit
Module Two: Services
So Business Unit has an Array of Guid related to Services. I've created a Widget where you can click on the service and it would load the service information, but now I want to show all the business units in the service. I've had to do it this way because I'll be displaying all Units in an Area as well and suspect they may have a Unit in multiple service areas knowing how users like to change things :)
So are there any suggestions on how I can retrieve these? I thought I would start with the Page Guid but what I really want is the Guid of the Service that was passed to the page and then to be able to run a Linq query using that. What I've got so far throws an error of:
Database mapped field uses different type 'System.Guid[]'.
Parameter name: methodCallExpression
Actual value was re-d.FieldValue("Service").
Which was generated from
var pManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
Telerik.Sitefinity.Pages.Model.PageData page = pManager.GetPageData(new Guid(currentNode.Key));
if (page != null)
{
var serviceGuid = new Guid(SiteMapBase.GetCurrentProvider().CurrentNode.Key);
var list = new List<Guid>();
list.Add(serviceGuid);
Guid[] guidList = list.ToArray();
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
Type serviceType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Services.Service");
Type businessUnitType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.BusinessAreas.BusinessUnit");
myFilteredCollection = dynamicModuleManager.GetDataItems(businessUnitType)
.Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true)
.Where(d => d.GetValue<TrackedList<Guid>>("Service").Contains(guidList))
.OrderBy(i => i.GetValue<System.Decimal>("SortOrder"));
}
Would love any hints as to where I should be looking. I feel like I've hit the point of reading the same five posts and blogs continuously.