# Vision - Script Custom Properties (w/default values) onto UDT Definitions

**URL:** <https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 26, 2024, 10:11pm UTC](https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177 "2024-08-26T22:11:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JHortenberry](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JHortenberry](https://forum.inductiveautomation.com/u/JHortenberry)\
**Post date:** [August 26, 2024, 10:11pm UTC](https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177/1 "2024-08-26T22:11:40Z")

</div>

Vision Project (v8.1.42)

I have several large (nested) UDT structures ... and I need to add several custom properties to each UDT member of given types.

Is there a way to script the addition of the custom properties (with default values) to the UDT defs?

OTW ... manual additions are a slow process...

Example:

udtA  
udtA1  
udtA2  
...  
udtAx

needs the following structure

udtA  
udtA1  
udtA1.cp11  
udtA1.cp12  
...  
udtA1.cp1y

udtA2  
udtA2.cp21  
udtA2.cp22  
...  
udtA2.cp2y  
...

udtAx  
udtAx.cpx1  
udtAx.cpx2  
...  
udtAx.cpxy

Thanks!

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 27, 2024, 3:52am UTC](https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177/2 "2024-08-27T03:52:27Z")

</div>

This is not Vision related at all; you can use scripting to do this using simple tag writes (system.tag.write\*). Don't have time for an example atm though sorry

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [August 27, 2024, 11:30am UTC](https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177/3 "2024-08-27T11:30:21Z")

</div>

Do you need to write to a custom property that already exists, or do you need to add the custom property to the UDT?

For just writing to them you can create a script that will write to them all. It would be a combination of a loop possibly if you have multiple folders to get all of the tag paths, or if you have all of them in the same place you can get all the tag paths with `system.tag.browse('pathToUDTs')` and then just use system.tag.write like @nminchin said.

For writing to custom properties, you do it the same way as a normal tag value. so, if I had a udt called furnace\_1 and it has a member called state I could have a custom property on that called codeScale and it has a value of 5 and I need it to be a value of 10 I could use `system.tag.writeBlocking(['[default]furnace_1/state.codeScale'],[10])`

The same would apply to your instances but you can pass them into the array params and handle it that way for multiples.

If you just want to add them to the UDTs in general updating the definition of the UDT will add the custom properties to every instance.

---

<div class="post-metadata">

**Author:** ![JHortenberry](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@JHortenberry](https://forum.inductiveautomation.com/u/JHortenberry)\
**Post date:** [August 27, 2024, 11:39am UTC](https://forum.inductiveautomation.com/t/vision-script-custom-properties-w-default-values-onto-udt-definitions/95177/4 "2024-08-27T11:39:59Z")

</div>

Thanks Nick!

...you are correct, if the custom property doesn't exist; a write\* to the UDT def will create and assign the default value...
