# AncestorId ordenation

**URL:** <https://forums.losant.com/t/ancestorid-ordenation/5905>\
**Category:** Bug Report\
**Created:** [August 20, 2025, 12:09pm UTC](https://forums.losant.com/t/ancestorid-ordenation/5905 "2025-08-20T12:09:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Ruckert](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/gabriel_ruckert/32/4719_2.png) [@Gabriel\_Ruckert](https://forums.losant.com/u/Gabriel_Ruckert)\
**Post date:** [August 20, 2025, 12:09pm UTC](https://forums.losant.com/t/ancestorid-ordenation/5905/1 "2025-08-20T12:09:20Z")

</div>

Hello! I’m facing a problem during a “Device:Get” request. We have this field called “ancestorIds”, which should be in order, like: [“customer”, “site”, “plant”, …] — that’s the correct hierarchy order. However, sometimes what we get is: [“plant”, “customer”, “site”, …].  
Could you please help me ?

What happenned:  
For device **22cd** , the ancestor IDs were returned in the wrong order. The images below illustrate the error:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/0/02893d01d2c3be0b472c8bab835049c79fab878a.png)  
Console version

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/e/e41e7d7a358e09387037b5361784e008146a3c74.png)

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 20, 2025, 1:06pm UTC](https://forums.losant.com/t/ancestorid-ordenation/5905/2 "2025-08-20T13:06:47Z")

</div>

Hello, I’m taking a look at this now. If you could PM me the application ID and the workflow ID where you are seeing this behavior, that would be helpful.

---

<div class="post-metadata">

**Author:** ![Gabriel\_Ruckert](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/gabriel_ruckert/32/4719_2.png) [@Gabriel\_Ruckert](https://forums.losant.com/u/Gabriel_Ruckert)\
**Post date:** [August 20, 2025, 1:35pm UTC](https://forums.losant.com/t/ancestorid-ordenation/5905/3 "2025-08-20T13:35:47Z")

</div>

I sent you a reliable device where this error is always happening 😃

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 20, 2025, 2:11pm UTC](https://forums.losant.com/t/ancestorid-ordenation/5905/4 "2025-08-20T14:11:43Z")

</div>

I spoke with the engineering team about this; the `ancestorIds` array is _usually_ in the order of the system hierarchy but it is not guaranteed to be in the correct order. Something that would guarantee the difference in order would be changing the system hierarchy of a device further up the tree.

I will file a feature request about making the order of items in the array always reflect the parentage hierarchy, but I do not have a timeline for when we will have that implemented.
