# Changing tag values on click action

**URL:** <https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908>\
**Category:** Ignition\
**Tags:** scripting, ignition81, perspective\
**Created:** [September 8, 2022, 11:50pm UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908 "2022-09-08T23:50:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AliE](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@AliE](https://forum.inductiveautomation.com/u/AliE)\
**Post date:** [September 8, 2022, 11:50pm UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908/1 "2022-09-08T23:50:49Z")

</div>

Hi,

When I run this script in the console, the tag values change as expected.

 ![s1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f33084181ace75c36afa84041eecf176af0bf8b.jpeg)

However, when I use the exact same script in an ‘onClick’ mouse event, the tag values do not change. These are just memory tags without any write security permissions set.

 ![s2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/e/3e5530d30a4b11d261ea09af34c4280a240c556b.jpeg)

What am I missing here?

Thank you,  
Ali

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 9, 2022, 1:16am UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908/2 "2022-09-09T01:16:07Z")

</div>

In that picture, it doesn’t look like your changes have been applied. When you click the apply button, does the asterisk by `onClick` go away?

---

<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:** [September 9, 2022, 4:36am UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908/3 "2022-09-09T04:36:59Z")

</div>

Your navigation action is navigating away from the page and cancelling your script. Actions are started in order but are executed asynchronously; they do not wait for the previous to finish before running. Script actions have to be sent to the gateway and are thus the slowest to run, and I believe they're terminated if the owner is closed. I actually started a topic about this exact situation

> [@Component action numbered order is deceptive for inexperienced users](https://forum.inductiveautomation.com/t/component-action-numbered-order-is-deceptive-for-inexperienced-users/63906):
>
> I recently had a question from a colleague who is fairly new to Ignition about why his component actions weren’t working properly. Turns out he had two actions defined that were supposed to happen in succession; however, the order that these events happen is actually indeterminate while the actions are executed in order, they are run asynchronously and can therefore finish out of order, but the interface itself makes it seem as though they will run sequentially. [image]

---

<div class="post-metadata">

**Author:** ![AliE](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@AliE](https://forum.inductiveautomation.com/u/AliE)\
**Post date:** [September 12, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908/4 "2022-09-12T15:14:47Z")

</div>

I assuming there is no workaround at this time. It kind of defeats the purpose of ordering the actions. I wish there was an option to make the second action start only after the first has completed or at least add a timer.

---

<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:** [September 12, 2022, 3:23pm UTC](https://forum.inductiveautomation.com/t/changing-tag-values-on-click-action/63908/5 "2022-09-12T15:23:39Z")

</div>

Sure there are workarounds, you can write the script to do the actions in the manner and order that you want. Do navigation in the script.
