Getting a page with PageByFieldTemplateCache.TryFindPage from integration code

I would like to send a mail like the OrderConfirmationMail and I’m trying to fetch the my page with the PageByFieldTemplateCache.TryFindPage. But the call is from integration code and the routeRequestLookupInfoAccessor.RouteRequestLookupInfo is always null. Therefore the page is always null.

Should I use the pageService to get the page instead?

Litium version: 7

1 Like

Of course with integration (if it is a background task) you got no session state and therefor routeRequestLookupInfoAccessor.RouteRequestLookupInfo is always null.
Use PageService if it can find what you are looking for.

Ok, I will try with the pageService.
What´s the preferred way to get a certain page with the pageService? The Id is not set so I cant use Get(id).

If you are doing this in integration process then you need to set Ids for the pages through integration or DB before you can access them.