# Modify UDT parameter in a Script

**URL:** <https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [August 5, 2022, 5:21pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729 "2022-08-05T17:21:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![imt.sebastian.sanche](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@imt.sebastian.sanche](https://forum.inductiveautomation.com/u/imt.sebastian.sanche)\
**Post date:** [August 5, 2022, 5:21pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/1 "2022-08-05T17:21:24Z")

</div>

I have a UDT for some AGVs with various parameters. The AGV locates to what we call ID Points which are in different stations through the line. I want to have a script get the ID point and from that ID point change the “Station” parameter. So I can use it later on an alarm to know which AGV on which Station is faulted.

I’m pretty new to scripting so I want to understand if this is possible. I don’t really want to do it in the expression of the alarm because it will be lentgthy and I think it can be shorter in a script.

---

<div class="post-metadata">

**Author:** ![plo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/plo/32/33875_2.png) [@plo](https://forum.inductiveautomation.com/u/plo)\
**Post date:** [August 16, 2022, 10:11pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/2 "2022-08-16T22:11:12Z")

</div>

Hello imt.sebastian.sanche!  
With scripting you can write to UDT parameter the same way you write to tags. You just to specify the proper path to the parameter. IE: [default]tree1 is my UDT instance. Then [default]tree1/Parameters.myString1 would be to my UDT parent parameter called “myString1”

[https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking](https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking)

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 26, 2022, 4:15am UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/3 "2022-10-26T04:15:15Z")

</div>

Hello Plo,

Can I do the same but to the data type itself (not an instance) so every instance gets their parameter updated?

Example:  
`system.tag.writeBlocking("[default]_types_/myUdt/Parameters.Reset", [1])`

It sort of works.  
When I open the UDT type I see the parameter value changes, nice.  
However, when I open an instance in the tag browser the parameter value doesn't change.

v8.1.18

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2022, 9:39am UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/4 "2022-10-26T09:39:34Z")

</div>

Has that parameter been overridden in that instance ?

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 26, 2022, 2:01pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/5 "2022-10-26T14:01:25Z")

</div>

@pascal.fragnoud No, it's not overridden in the instance. A colleague suggested it may not update in the tag browser because their isn't a time stamp associated with it.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2022, 2:04pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/6 "2022-10-26T14:04:12Z")

</div>

I'm not seeing this behavior in 8.1.21. Writing to a udt parameter with `system.tag.writeBlocking` does update the instance's parameter's value in my case.

---

<div class="post-metadata">

**Author:** ![plo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/plo/32/33875_2.png) [@plo](https://forum.inductiveautomation.com/u/plo)\
**Post date:** [October 26, 2022, 3:21pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/7 "2022-10-26T15:21:36Z")

</div>

Hello Edward, If you were wanting to edit the UDT definition itself, I would suggest using system.tag.configure(). There's a pretty good example near the bottom of the User Manual below. See the `Python - Writing to Parameters in UDT Definition section`

[https://docs.inductiveautomation.com/display/DOC81/system.tag.configure](https://docs.inductiveautomation.com/display/DOC81/system.tag.configure)

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 27, 2022, 1:53pm UTC](https://forum.inductiveautomation.com/t/modify-udt-parameter-in-a-script/62729/8 "2022-10-27T13:53:20Z")

</div>

Closing this thread due to me making a coding error.  
The UDT parameter is a String.  
I forgot I'd overridden it to an Integer in the Instance.  
No wonder the write wouldn't work.  
Apologies for wasting your time.  
Regards,  
Ted.
