# Tag Value Changed script does not appear to execute?

**URL:** <https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [August 18, 2023, 2:27am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046 "2023-08-18T02:27:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 2:27am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/1 "2023-08-18T02:27:43Z")

</div>

Hi All,  
I am trying to figure out why a script on Value Changed does not appear to be executing. I have viewed several other posts and tried many thing, but all to no avail.

Ultimately, I want to write to an OPC tag when another tag's state changes. In the process of trying to chase down why it wasn't working, I resorted to creating a few memory tags (all within the same tag provider and folder). One memory tag has a simple tag change script. When executing, it is to write a new value to a different tag.

I have tried the following script in the Script Console (using absolute tag paths) and it works as expected. I have tried it within the tag change script with both absolute and relative paths, but no luck.

The diagnostics on the tag shows no errors.  
The "enabled" check box for the Value Changed script is checked. I've tried toggling it off and on.  
The tag provider is executing. I created an expression script to toggle a boolean on/off every one second and this works fine.

I have tried finding a log that has _any_ indication of this script running or errors, but have been unsuccessful.  
Places I have looked for a log:

- Ignition Designer \> Tools \> Console
- Ignition Server Webpage \> Status \> Diagnostics \> Logs
- Ignition Server Webpage \> Status \> Diagnostics \> Running Scripts
- Ignition Server Webpage \> Systems \> Gateway Scripts \> Tag Change

And here's the simple script (various iterations commented):

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):

# test4 is an integer memory tag
# test2 is a boolean memory tag

	system.tag.writeAsync(['[.]test4'], [123])
#	system.tag.writeAsync(['[provider]Copied/Path/To/test4'], [123])
#	system.tag.writeAsync(['[.]test2'], [1])
#	system.tag.writeAsync(['[provider]Copied/Path/To/test2'], [1])

```

I've been banging my head on the wall (or desk) for some time and unable to get this resolved. Any help would be greatly appreciated. Thanks in advance.

Matt

---

<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 18, 2023, 2:31am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/2 "2023-08-18T02:31:18Z")

</div>

Have you looked on the tag's diagnostics tab? This is where value change script errors will go. They most likely appear in the wrapper log / gw logs as well, not sure though what they would be logged under

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 2:39am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/3 "2023-08-18T02:39:47Z")

</div>

By the tag's diagnostics, I assume you mean the "heartbeat" graphic on the top-right of the tag-editor window. Yes. There are no errors.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/edf99d78861754b824beed28954c27213ebc8cb7.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dcbd446249cd295e0fa99aacc85a3672ba283ab6.png)

Is the wrapper log / gw log indicated in the list in first post? If so, I have thoroughly checked those with no indication in them at all of the script or tag.

---

<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 18, 2023, 2:42am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/4 "2023-08-18T02:42:40Z")

</div>

Try these tags?

```auto
{
  "tags": [
    {
      "valueSource": "memory",
      "name": "New Tag",
      "value": 123,
      "tagType": "AtomicTag"
    },
    {
      "valueSource": "memory",
      "eventScripts": [
        {
          "eventid": "valueChanged",
          "script": "\tsystem.tag.writeAsync(\u0027[.]New Tag\u0027, 123)"
        }
      ],
      "name": "New Tag 1",
      "value": 5,
      "tagType": "AtomicTag"
    }
  ]
}

```

---

<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 18, 2023, 2:47am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/5 "2023-08-18T02:47:20Z")

</div>

You can also print the return from the tag write... actually you'll need to change it to a blocking read, or use a callback function... into a gw logger

```auto
LOGGER = system.util.getLogger('Superman')
ret = system.tag.writeBlocking(...)
LOGGER.info(ret)

```

Then look for the Superman log in the loggers 🙂

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 2:48am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/6 "2023-08-18T02:48:05Z")

</div>

Thanks. I imported the tags. Set the value of "New Tag" to 0 (zero). Then changed the value of "New Tag 1". I would expect the script on "New Tag 1" to update the value of "New Tag" to the number 123. However, it does not change the value at all. I am puzzled.

---

<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 18, 2023, 2:48am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/7 "2023-08-18T02:48:56Z")

</div>

That's exactly how it works on my system.. strange. If I think of something else, i'll let you know, but that's unusual

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 2:56am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/8 "2023-08-18T02:56:18Z")

</div>

I'm assuming this is where to find the Logger? I've replaced the script in "New Tag 1" with what you provided. (replacing the tag path and value for writeBlocking, of course) Then making a change to the tag value.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0fe97b6fa9af8d0923e2211e54d045ee5e249aeb.png)

No Superman here...

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 3:00am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/9 "2023-08-18T03:00:38Z")

</div>

I tried using your tags on a different tag provider... same results. It will not update the second tag.

---

<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 18, 2023, 3:07am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/10 "2023-08-18T03:07:46Z")

</div>

Not running in trial mode and it's expired?

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 3:09am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/11 "2023-08-18T03:09:43Z")

</div>

Boy, wouldn't that be a treat! 😅 No, this on an active production line. Besides, the expression tag (mentioned at the first) is happily toggling away.

---

<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 18, 2023, 11:58am UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/12 "2023-08-18T11:58:34Z")

</div>

> [@MattR](#):
>
> No, this on an active production line.

Oy! Somebody is braver than they should be.

---

<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 18, 2023, 12:00pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/13 "2023-08-18T12:00:09Z")

</div>

Meanwhile, check that the script is **enabled**.

Also, use that logger to send something to the log at the **beginning** of the script, just so you know the script is running.

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 12:41pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/14 "2023-08-18T12:41:54Z")

</div>

I might be braver than I should be... 🤔

Yes, this script is enabled.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/734603b6251d1592328022599fb1a64f049cdbdd.png)

I've changed the value a few times, but no dice. It's not showing up in the logger. I'm thinking either I am missing something really dumb or something is wacky on the server.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 18, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/15 "2023-08-18T13:49:16Z")

</div>

This doesn’t happen to be a client tag or perhaps a tag from a remote provider?

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 18, 2023, 5:21pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/16 "2023-08-18T17:21:27Z")

</div>

Thank you, I've tried this on two tag providers. Both are "standard" (non-remote).

Client tags, I believe are in Vision. I am using Perspective... so no, it isn't a client tag. Just simple memory tags in a standard tag provider.

---

<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:** [August 18, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/17 "2023-08-18T17:31:36Z")

</div>

I recommend giving tech support a call so they can take a look.

---

<div class="post-metadata">

**Author:** ![jason.goshorn](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jason.goshorn](https://forum.inductiveautomation.com/u/jason.goshorn)\
**Post date:** [August 23, 2023, 1:25pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/18 "2023-08-23T13:25:18Z")

</div>

I've experienced the same thing. When it happened, I copied the script that was not working and created a new tag change event and pasted the code into the new. I then deactivated the old and activated the new. Once the new worked, I deleted the old. No idea what made this happen, I assume somehow a link got broken when I was making changes, but this made it work, so I never worried about finding the cause.

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 23, 2023, 3:39pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/19 "2023-08-23T15:39:47Z")

</div>

Hi Jason, welcome to the forum!

Unfortunately, we have discovered that this is a widespread issue and many tag structures (that existed prior to my working on this project) that have an event change script are no-longer working. We are waiting for a response from Ignition. I'm thinking the quick-fix is rebooting the server. This, however, would not be a solution, but inevitably mask any underlying problem that caused it in the first place.

---

<div class="post-metadata">

**Author:** ![MattR](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@MattR](https://forum.inductiveautomation.com/u/MattR)\
**Post date:** [August 28, 2023, 1:09pm UTC](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046/20 "2023-08-28T13:09:50Z")

</div>

Update on the troubleshooting efforts. The cause was determined to be from an abundance of scripts and queries running. The threshold was increased to prevent this issue from occurring.

[Next page](https://forum.inductiveautomation.com/t/tag-value-changed-script-does-not-appear-to-execute/78046.md?page=2)
