# Access Last Child Variable from single tree select

**URL:** <https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635>\
**Category:** Technical assistance\
**Created:** [December 23, 2022, 9:28am UTC](https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635 "2022-12-23T09:28:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![VanPatrick](https://community.zammad.org/letter_avatar_proxy/v4/letter/v/7bcc69/32.png) [@VanPatrick](https://community.zammad.org/u/VanPatrick)\
**Post date:** [December 23, 2022, 9:28am UTC](https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635/1 "2022-12-23T09:28:04Z")

</div>

### Infos:

- Used Zammad version: 5.3.0-1670492123.7c45d087.centos8
- Used Zammad installation type: package
- Operating system: CentOS Stream release 8
- Browser + version: Firefox 102.6.0esr (64-Bit

### Expected behavior:

- Use only the Last Child of an self-created nested single tree-select object for notification via trigger like discribet in the admin documentation ([https://admin-docs.zammad.org/en/latest/system/variables.html#wait-what-about-custom-objects](https://admin-docs.zammad.org/en/latest/system/variables.html#wait-what-about-custom-objects))

### Actual behavior:

- If i use ticket.object it works perfect but shows the entire tree select path.  
If i use ticket.object.value or ticket.object.select.value i got a “no such method” error.

### Steps to reproduce the behavior:

- Create Object: singe tree select with two rows and one child per row
- Create Trigger: Object changed, add notice "Ticket moved to #{ticket.object.value}
- Open New Ticket as Customer an select Object from tree select
- Open Ticket as Agent an change Object via tree select

**Question** :  
Is it possible to use only the last child from a tree select choice?  
What is the Variable to access the last child?

Sorry, this is my first question an i hope i used the template correct an my question is understandable.  
Thanks 😉

---

<div class="post-metadata">

**Author:** ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)\
**Post date:** [January 3, 2023, 5:24pm UTC](https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635/2 "2023-01-03T17:24:56Z")

</div>

I’m afraid that’s not possible.  
Zammad provides the actual value the field technically has.

This is the way Zammad actually stores the value - this gets more obvious when you have a look on what Zammad returns for multiple tree selections:

```auto
a::aa::aaa (single)
b, c, b::bb (multi)

```

The UI has filters and hooks that makes the selection and display much more user friendly - but backend wise there’s no such thing. If you believe that this is a missing feature, feel free to create a feature request here:

> **[Feature requests](https://community.zammad.org/c/stuff-you-like-zammad-to-have-feel-free-to-discuss-and-add-proposals/6)**
>
> We often receive feature requests… through all different channels. We’d like to have them all here in one place. So everyone, who is interested can participate.
> 
> Also we think about to introduce a community voting for features. We tried it at GitHub, which resulted in muddled pile of tickets.

---

<div class="post-metadata">

**Author:** ![VanPatrick](https://community.zammad.org/letter_avatar_proxy/v4/letter/v/7bcc69/32.png) [@VanPatrick](https://community.zammad.org/u/VanPatrick)\
**Post date:** [January 4, 2023, 1:50pm UTC](https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635/3 "2023-01-04T13:50:25Z")

</div>

Thanks MrGeneration.

Maybe it will be a feature in future.

---

<div class="post-metadata">

**Author:** ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)\
**Post date:** [May 4, 2023, 1:51pm UTC](https://community.zammad.org/t/access-last-child-variable-from-single-tree-select/10635/4 "2023-05-04T13:51:20Z")

</div>

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