# Gateway Event Scripts - Tag change event don't fire

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622>\
**Category:** Ignition\
**Created:** [June 13, 2020, 12:19pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622 "2020-06-13T12:19:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 13, 2020, 12:19pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/1 "2020-06-13T12:19:11Z")

</div>

I try to setup a gateway evnt script on tag change and run a function in my Gateway Scripting Project, but the event is not fired.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fa8bc936af8351cf64feae43927bd866861763e8.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1afdb864e3cab2831a3ad8c3f3c6fd056a9ea970.png)

It’s a simple function that write into a file…

```auto
def wLog(msg):
	f = open("C:\\Users\\lucm\\Desktop\\MyLogFile.txt","a")
	from time import strftime
	timestr = strftime("%Y-%m-%d %H:%M:%S")
	m = "[" + timestr + "] " + msg + "\n"
	f.write(m)
	f.close()

```

I use many script directly into my tags and all fired great, but this time I want to put it into the gateway event and can’t understand why the event is not fired.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 13, 2020, 1:15pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/2 "2020-06-13T13:15:26Z")

</div>

Gateway Event Tag Change scripts (and any other event script in this section) belong to a project, so they need to reference a function defined in the project (or a parent’s) script library.

The tag change scripts defined directly on tags are the ones that do not belong to any project and will use the project designated as “Gateway Scripting Project”.

---

<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:** [June 13, 2020, 5:28pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/3 "2020-06-13T17:28:20Z")

</div>

Also, does user `lucm` exist on the gateway? And would the gateway service have access to that user’s directory? (Generally not.) A proper test would be to write to a folder that is owned by the Ignition service.

You might have entries in your gateway log showing a failure to open the given file.

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [June 14, 2020, 12:34am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/4 "2020-06-14T00:34:51Z")

</div>

Anyone else notice the change trigger “value” is unchecked…

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 14, 2020, 11:17am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/5 "2020-06-14T11:17:33Z")

</div>

The script is in the same project that I set my gateway tag events…  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7439a35ab755ce7e4e6e54b6d61efbfbfccd42ad.png)

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 14, 2020, 11:20am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/6 "2020-06-14T11:20:00Z")

</div>

I’m in testing mode, the gateway run on my local machine and my wLog function works well in every scope. I use it as console for debugging.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 14, 2020, 11:21am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/7 "2020-06-14T11:21:44Z")

</div>

I don’t want to get the value, I just want a quality change event…

---

<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:** [June 14, 2020, 11:26am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/8 "2020-06-14T11:26:06Z")

</div>

I think have different logging methods for testing vs. production is a disaster in the making. Your wLog() function looks pretty fragile to me. Aside from that, you didn’t indicate if there are any messages in your real gateway log. I’ll be out of touch today, but that’s where I would look were I in your shoes.

---

<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:** [June 14, 2020, 11:30am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/9 "2020-06-14T11:30:46Z")

</div>

Look closer at @Kevin.Herron’s comment: Project tag change events have access to the scripts in their inheritence hierarchy, which doesn’t necessarily include the scripts accessible to the Gateway Scripting Project that tag events use.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 14, 2020, 11:39am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/10 "2020-06-14T11:39:45Z")

</div>

I don’t want a robust solution, I just use that function as consol to print something to trace my code. When I put it into a tag on quality change event it work fine. My gateway tag change script is in the same project of my \_Functions.wLog function and that project is also my Gateway Scripting Project. I think it have no reason to not fired.

That script works wheel

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

That one not

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c4ed7b660e2cec8eff308357ad97f90e5eaffa45.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/68b8a292a669ca977207a112030eba6003b2c6ea.png)

It’s the same tag…

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 14, 2020, 12:20pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/11 "2020-06-14T12:20:46Z")

</div>

I have save my project and don’t see my Tag Change into the Status/Systems/Gateway Scripts…

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

I run on version 8.0.13

I have add Startup, Shutdown, Timer and Message Handler event and only Startup and Shutdown is shown in the Gateway script…

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

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [June 14, 2020, 4:25pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/12 "2020-06-14T16:25:02Z")

</div>

If this is your gateway scripting project, are you sure it is runnable (not inheritable)?

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 15, 2020, 12:06pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/13 "2020-06-15T12:06:01Z")

</div>

It’s an inheritable project. Why inheritable can have Startup/Shutdown event and not Tag, Timer and message event.

I have many projects that I want to base that project and all needs to have same tags event. I want a simple way to configure and update all projects and using an inheritable project semms to be the bes way to do it.

What’s the best solution for me now?

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [June 15, 2020, 1:33pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/14 "2020-06-15T13:33:04Z")

</div>

> [@luc.martin](#):
>
> Why inheritable can have Startup/Shutdown event

Startup and Shutdown scripts from an inheritable project should not run. If they do, this is most probably a bug.  
Are you sure it is not an other, runnable project that is executing those scripts? I am not sure, but i think inherited projects may shutdown and restart when a 'parent' project is changed.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 16, 2020, 1:03pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/15 "2020-06-16T13:03:33Z")

</div>

I found why my gateway event tag script in my inheritable project wasn’t publish. The gateway event on my heritate project is overrided. I don’t find on right click a solution to revert it.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 16, 2020, 1:14pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/16 "2020-06-16T13:14:25Z")

</div>

If you delete the overridden script it will revert back to the underlying inheritable one.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 16, 2020, 1:16pm UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/17 "2020-06-16T13:16:29Z")

</div>

All seems to be good now…

Thanks

---

<div class="post-metadata">

**Author:** ![marcg](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@marcg](https://forum.inductiveautomation.com/u/marcg)\
**Post date:** [September 3, 2020, 2:38am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/18 "2020-09-03T02:38:17Z")

</div>

> [@luc.martin](#):
>
> gateway event tag script in my inheritable p

hey brother how did you solve your problem? i have the same issue but im using timer,  
it seems the event i generated are not showing in status\>gateway scripts

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/6/46b54df99e534438872423a350e68d0b7146a28c.png)

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [September 3, 2020, 10:51am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/19 "2020-09-03T10:51:15Z")

</div>

I have builded a side project herited from my script project and I have place my tag event in.

---

<div class="post-metadata">

**Author:** ![marcg](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@marcg](https://forum.inductiveautomation.com/u/marcg)\
**Post date:** [September 3, 2020, 11:21am UTC](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622/20 "2020-09-03T11:21:48Z")

</div>

you put the event on the parent project (script project)? because i think thats my problem, i think i need to put the event on my parent project

[Next page](https://forum.inductiveautomation.com/t/gateway-event-scripts-tag-change-event-dont-fire/35622.md?page=2)
