# Tag change script not executing

**URL:** <https://forum.inductiveautomation.com/t/tag-change-script-not-executing/86760>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [March 4, 2024, 2:41pm UTC](https://forum.inductiveautomation.com/t/tag-change-script-not-executing/86760 "2024-03-04T14:41:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben522326](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@Ben522326](https://forum.inductiveautomation.com/u/Ben522326)\
**Post date:** [March 4, 2024, 2:41pm UTC](https://forum.inductiveautomation.com/t/tag-change-script-not-executing/86760/1 "2024-03-04T14:41:13Z")

</div>

Hello!

I'm learning ignition and practicing with scripting in Perspective. I am trying to execute a script when a boolean tag changes values. I can accomplish what I want to do on an onActionPerformed script with a toggle switch that is bound to the tag, however I want the script to execute when the tag itself changes (like simulating a value from a PLC or manually changing the value itself in the tag browser). I have tried a value changed script and a gateway tag change script and cannot get either to execute. I don't get any errors or see any of the print statements in the console.

In the example below, I want to manually change the value of machineStatus in the tag browser and have it trigger a script when changed. As of now, changing the value in the tag browser switches the corresponding toggle switch component, but no script executes. When I toggle the component itself, the script executes (because of the onActionPerformed script).

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

I have also tried a value changed script and cannot get it to execute either. How can I add a script to the tag that has the same functionality as the onActionPerformed script?

---

<div class="post-metadata">

**Author:** ![Ryan\_Ahlstrom](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@Ryan\_Ahlstrom](https://forum.inductiveautomation.com/u/Ryan_Ahlstrom)\
**Post date:** [March 4, 2024, 3:05pm UTC](https://forum.inductiveautomation.com/t/tag-change-script-not-executing/86760/2 "2024-03-04T15:05:14Z")

</div>

You should be able to accomplish this by adding a custom property to your view and then bind that to the 'machineStatus' tag. Add a 'change script' to this custom property which executes your code.  
Tag changes -\> Tag binding registers change -\> Custom property changes -\> Change script executes.

---

<div class="post-metadata">

**Author:** ![Ben522326](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@Ben522326](https://forum.inductiveautomation.com/u/Ben522326)\
**Post date:** [March 4, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/tag-change-script-not-executing/86760/3 "2024-03-04T15:22:56Z")

</div>

This worked. Thanks for your help!
