# Fetching a page / page field-data

**URL:** <https://forum.litium.com/t/fetching-a-page-page-field-data/357>\
**Category:** Questions\
**Tags:** accelerator, litium-7\
**Created:** [November 11, 2018, 8:31pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357 "2018-11-11T20:31:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PontvsXlent](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@PontvsXlent](https://forum.litium.com/u/PontvsXlent)\
**Post date:** [November 11, 2018, 8:31pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/1 "2018-11-11T20:31:44Z")

</div>

So basically I’m trying to fetch some field-data from the brandpage that is related to a product.  
In the accelerator, there is already a method for just this ( Litium.Accelerator.Builders.Product.ProductPageViewModelBuilder.GetBrandPage() ). The problem is that no field-data seems to be fetched, but the id is correct.

So is there way to either fetch the pagemodel with it’s fields from the id, or to the get the pagemodel to fetch its fields?

Litium version: 7

---

<div class="post-metadata">

**Author:** ![ton.nguyen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ton.nguyen/32/989_2.png) [@ton.nguyen](https://forum.litium.com/u/ton.nguyen)\
**Post date:** [November 12, 2018, 12:59pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/2 "2018-11-12T12:59:05Z")

</div>

First of all, make sure your page is published in order to get its field data. If the page is never published, the default page data contains nothing, maybe only the page name.

To get page’s fields, use PageService.Get(Guid systemId) to get the page object, then you can access its fields via page.Fields.

In case you want to get the field data of the Draft, use DraftPageService instead.

---

<div class="post-metadata">

**Author:** ![PontvsXlent](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@PontvsXlent](https://forum.litium.com/u/PontvsXlent)\
**Post date:** [November 12, 2018, 1:20pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/3 "2018-11-12T13:20:43Z")

</div>

The page is published. And when using PageService, the only fields that I can get is seems to be SystemFields for the BrandPage.

In the GetBrandPage method, I have added this for when I find the correct page:  
result = \_pageService.Get(page.SystemId).MapTo().MapTo();  
But all the properties in BrandViewModel that I have auto-mapped are null.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 12, 2018, 2:14pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/4 "2018-11-12T14:14:20Z")

</div>

Is there any other fields on the page that you have added field to?  
Are that fields culture dependent or culture independent?

If you check the result for `_pageService.Get(page.SystemId)`, will that contains the field you expect?  
In case they are there, do the first `.MapTo<PageModel>()` include the fields that you expect?

---

<div class="post-metadata">

**Author:** ![PontvsXlent](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@PontvsXlent](https://forum.litium.com/u/PontvsXlent)\
**Post date:** [November 12, 2018, 2:22pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/5 "2018-11-12T14:22:37Z")

</div>

Yes I have added new Fields, but they work just fine when I access the actual brand page.  
The new fields are not culture dependent.

> If you check the result for `_pageService.Get(page.SystemId)` , will that contains the field you expect?

No they are not there unfortunately.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 12, 2018, 2:26pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/6 "2018-11-12T14:26:15Z")

</div>

If you try to fetch the draft instead of the page, will you have the field values there?

`_draftPageService.Get(page.SystemId)`

---

<div class="post-metadata">

**Author:** ![PontvsXlent](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@PontvsXlent](https://forum.litium.com/u/PontvsXlent)\
**Post date:** [November 12, 2018, 2:32pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/7 "2018-11-12T14:32:16Z")

</div>

Sorry, I’m really embarrassed to say. That page had not been published. I had tried to publish the page in a different tab, and had gotten an error message that I missed.  
It’s working now, and I’m really sorry for wasting your time. But thank you all anyways!!

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 12, 2018, 2:47pm UTC](https://forum.litium.com/t/fetching-a-page-page-field-data/357/8 "2018-11-12T14:47:33Z")

</div>

No problem, and glad that you get it to work 🙂
