# Tag change scripts firing when tag properties edited

**URL:** <https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276>\
**Category:** Ignition\
**Created:** [August 15, 2018, 8:06pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276 "2018-08-15T20:06:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [August 15, 2018, 8:06pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/1 "2018-08-15T20:06:50Z")

</div>

How can I prevent gateway tag change scripts from executing when the tag properties are edited? Conditioning with not initialChange and previousValue.value != currentValue.value is not effective. Thanks.

Ignition 7.9.8

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [August 16, 2018, 6:39am UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/2 "2018-08-16T06:39:55Z")

</div>

I created a tag ( Memory Tag ), used it as trigger for a tag change script ( inside Gateway Events Scripts ).  
Inside my page I have a button that changes a property of this tag ( EngHigh ), but when I click it, no script is fired.  
I tried all the combination for “Change Triggers” ( the options Value, Quality, Timestamp ) but still nothing.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 16, 2018, 10:26am UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/3 "2018-08-16T10:26:23Z")

</div>

In case it’s not clear, try using Gateway Tag Change Event Scripts, not Tag Events. { There are many other good reasons, too. }

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [August 16, 2018, 12:09pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/4 "2018-08-16T12:09:48Z")

</div>

Thanks, this is good information. This may be the case for scripted changes, but right-clicking on a tag to enter the tag editor and clicking OK (whether or not any changes have been made) will fire the tag change script.

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [August 16, 2018, 12:18pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/5 "2018-08-16T12:18:27Z")

</div>

Thanks Phil. I have not noticed a difference and in fact in this case I am using a gateway event script triggered by a tag change (I should note that I have only selected ‘Value’ as the change trigger). Maybe this is not too big of an issue. It was only a problem for me after creating and re-assigning some scan classes which ultimately created a fair amount of bad data needing to be cleaned up. If there is a method to prevent this I would add it to my common script header.

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [August 16, 2018, 12:19pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/6 "2018-08-16T12:19:04Z")

</div>

This is because the Tag gets refreshed. It’s something like its value goes from something (your value) to NULL to something (your value). This is seen as a value change so the scripting event will fire.

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [August 16, 2018, 4:53pm UTC](https://forum.inductiveautomation.com/t/tag-change-scripts-firing-when-tag-properties-edited/19276/7 "2018-08-16T16:53:09Z")

</div>

This is a good point. Ok, so I achieved the result I wanted by adding the condition previousValue.value is not None and currentValue.value is not None. This prevents the tag change script from running when the tag editor is saved and closed.
