Problem to get a page from Template when we have a panel in aspx

We try to get a page to redirect to from a panel that are created in aspx. And we can’t use the same function as we use for other pages. We got null when we tries to do the last step, .MapTo().

we use this one:

            var pageTemplate = _fieldTemplateService.Get<PageFieldTemplate>(pageTemplateName);
            
            using (var query = IoC.Resolve<DataService>().CreateQuery<Page>())
            {
                query.Filter(f => f
                           .TemplateSystemId("eq", pageTemplate.SystemId))
                           .ToList()
                           .ToLookup(x => x.WebsiteSystemId);

                return query.Count() > 0 ? query.FirstOrDefault().MapTo<PageModel>() : null;
            }

What version are you on?

7.2.3 sorry for forget to add it.

We tried this and it works for us, check pageTemplateName to be sure it exists. It is the Id of the page template.

It working from the public site, but not from a panel.

When mapping to PageModel some additional info needs to be set, I’m guessing it isn’t when it’s done from a panel.

Have a look at this thread: Problem with mapping in scheduled task

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.