# Getting Child Categories of category when indexing

**URL:** <https://forum.litium.com/t/getting-child-categories-of-category-when-indexing/2610>\
**Category:** Questions\
**Created:** [June 3, 2022, 1:56pm UTC](https://forum.litium.com/t/getting-child-categories-of-category-when-indexing/2610 "2022-06-03T13:56:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian.Engvall](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Christian.Engvall](https://forum.litium.com/u/Christian.Engvall)\
**Post date:** [June 3, 2022, 1:56pm UTC](https://forum.litium.com/t/getting-child-categories-of-category-when-indexing/2610/1 "2022-06-03T13:56:40Z")

</div>

Hi!

I need to get hold of child categories when indexing with ElasticSearch.  
If i call **category.GetChildren()** I get this error:

_error when indexing category System.ArgumentNullException: Value cannot be null. (Parameter ‘Method can only be executed inside a webrequest where RouteRequestLookupInfo is assigned.’)_

Is there a safe way of getting hold of the child categories outside a webrequest? If I can get the systemIds of the child categories somehow I could use the category-service to get the info I want from each of them. Is that possible?

Litium version: 8.3

---

<div class="post-metadata">

**Author:** ![Christian.Engvall](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Christian.Engvall](https://forum.litium.com/u/Christian.Engvall)\
**Post date:** [June 3, 2022, 2:20pm UTC](https://forum.litium.com/t/getting-child-categories-of-category-when-indexing/2610/2 "2022-06-03T14:20:14Z")

</div>

Found an overloaded extension method that worked: **category.GetChildren(false, false, channel.SystemId)**

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [July 1, 2022, 2:21pm UTC](https://forum.litium.com/t/getting-child-categories-of-category-when-indexing/2610/3 "2022-07-01T14:21:03Z")

</div>

Closed on July 1, 2022, 2:21pm UTC

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