# How do I reference UDT parameters in valued changed script

**URL:** <https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [January 9, 2023, 11:09pm UTC](https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403 "2023-01-09T23:09:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isaac\_Hodgkins](https://avatars.discourse-cdn.com/v4/letter/i/59ef9b/32.png) [@Isaac\_Hodgkins](https://forum.inductiveautomation.com/u/Isaac_Hodgkins)\
**Post date:** [January 9, 2023, 11:09pm UTC](https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403/1 "2023-01-09T23:09:31Z")

</div>

I have a value changed script for a tag within a UDT. I would like to reference the parameter {InstanceName} so that I can call in the name of the UDT to the script. I tried doing this with curly brackets but it didn't work. How might I do this? Thanks!

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 10, 2023, 4:07am UTC](https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403/2 "2023-01-10T04:07:10Z")

</div>

From a valueChanged script, it should just be `tag.name`.

Note the parameters that are inherent to the function:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/4/8497ae028f24a99a75494fa53f7e490244b436b4.png)

If it's a tag that is deeply nested within the UDT, and you need the root parent's instanceName, then you can parse the name out of the tagPath:

**Example:**

```auto
tagPath.split('/')[1]

```

Edit:  
It could also be parsed form the backside of the path, in case the tag nesting level varies:  
Example:

```auto
tagPath.split('/')[len(tagPath.split('/'))-2]

```

---

<div class="post-metadata">

**Author:** ![Isaac\_Hodgkins](https://avatars.discourse-cdn.com/v4/letter/i/59ef9b/32.png) [@Isaac\_Hodgkins](https://forum.inductiveautomation.com/u/Isaac_Hodgkins)\
**Post date:** [January 12, 2023, 6:52pm UTC](https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403/3 "2023-01-12T18:52:35Z")

</div>

I used tag['parameters']['InstanceName'] to get access to the InstanceName parameter.

---

<div class="post-metadata">

**Author:** ![Om33](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@Om33](https://forum.inductiveautomation.com/u/Om33)\
**Post date:** [January 19, 2024, 10:48am UTC](https://forum.inductiveautomation.com/t/how-do-i-reference-udt-parameters-in-valued-changed-script/68403/4 "2024-01-19T10:48:35Z")

</div>


