# Scripted editing of UDT definitions - modifying alarm names

**URL:** <https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [May 19, 2020, 4:00am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869 "2020-05-19T04:00:12Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [May 19, 2020, 4:00am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/1 "2020-05-19T04:00:12Z")

</div>

I’m trying to script the bulk editing of alarm names within a UDT definition, e.g. the highlighted property. Basically I want to bulk rename the alarm name to the alarm tag name. I really wish that this was accessible as a property to show in the alarm headers…  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2ef09a24854cad9f96f92a11b5a1304fe7223995.png)

I’m struggling… does anyone have a script already to do this or something similar?

I have this:  
Very simple UDT definition for testing with:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a2d895393bea02f3ad94b86e9be2bb2e25b23a76.png)

```auto
udtTagFolder = '_types_/_Testing'
udtName = 'Simple'
tagsc = system.tag.browseConfiguration(udtTagFolder,1)
for tagc in tagsc:
	if tagc.getName() == udtName:
		tags = tagc.getSubTags()
		# gets the first "tag" i.e. the folder "Alarms",
		# then gets the tags within the folder (array of 1 tag),
		# the the 1st tag within the folder ('Faulted'), and its alarm configuration
		alarms = tags[0].getSubTags()[0].getAlarms()
		print alarms, type(alarms)
		for alarm in alarms:
			print alarm, type(alarm)

```

The result of this is:

```auto
[Faulted] <type 'com.inductiveautomation.ignition.common.tags.config.AlarmDefinitions'>
Faulted <type 'com.inductiveautomation.ignition.common.alarming.config.BasicAlarmDefinition'>

```

I’m not quite sure how to edit `alarm`'s `name` property and then write it back to the tag configuration.

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [January 23, 2023, 11:35pm UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/2 "2023-01-23T23:35:03Z")

</div>

Hi Nick,

Did you get anywhere with this?  
I'm currently looking at trying to build a Vision popup which can display (and eventually hopefully re-configure using scripting) the alarm configuration for any UDT tag instance.

Struggling with the fact that the new system.tag.getConfiguration only returns **changed** properties, not ALL which is very frustrating.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 24, 2023, 12:27am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/3 "2023-01-24T00:27:55Z")

</div>

Be aware that editing alarms in UDTs via scripting will override the entire alarm definition, which kind of defeats the purpose of a UDT.

There are some examples here,  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.configure](https://docs.inductiveautomation.com/display/DOC81/system.tag.configure)

---

<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:** [January 24, 2023, 2:29am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/4 "2023-01-24T02:29:21Z")

</div>

There's a script i've posted before that gets all alarm config fields, I'll have to find it

Edit: Found it

> [@system.tag.getAlarmStates alternative?](https://forum.inductiveautomation.com/t/system-tag-getalarmstates-alternative/27803/13):
>
> Update: You can get the alarm default values using: from com.inductiveautomation.ignition.common.alarming.config import CommonAlarmProperties, AlarmModeProperties properties = {} properties.update(dict((s.getName(), s.getDefaultValue()) for s in CommonAlarmProperties.values())) properties.update(dict((s.getName(), s.getDefaultValue()) for s in AlarmModeProperties.values()))

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [January 24, 2023, 2:43am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/5 "2023-01-24T02:43:21Z")

</div>

I think i've managed to avoid this now with my latest iteration of configure scripts. You need to just ensure you only send back the json values required for the change, and not the whole configuration object.

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [January 24, 2023, 2:46am UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/6 "2023-01-24T02:46:13Z")

</div>

Thanks will have a look through all that.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 24, 2023, 2:12pm UTC](https://forum.inductiveautomation.com/t/scripted-editing-of-udt-definitions-modifying-alarm-names/34869/7 "2023-01-24T14:12:18Z")

</div>

> [@richardNZ15](#):
>
> I think i've managed to avoid this now with my latest iteration of configure scripts. You need to just ensure you only send back the json values required for the change, and not the whole configuration object.

Best of luck, unless they changed it in the last month, it doesn't work that way for alarms. You can do what you described for tags, just not alarms.
