Gateway and Client scripts won't run when triggered

I have tried to trigger a script from the Client and Gateway Scripts but they do not run and there are no errors reported when triggered. What am I missing? My trigger tag is listed on the tag page.


Here is my script which should work.

trg =“Downtime_Reporting/TRG”).value

if trg == 1:
system.tag.write(“Downtime_Reporting/DT_Location”,event.source.parent.getComponent(‘Drop Machine ID’).selectedLabel)
system.tag.write(“Downtime_Reporting/DT_Reporter”,event.source.parent.getComponent(‘Drop Reporter’).selectedLabel)
system.tag.write(“Downtime_Reporting/DT_Cause”,event.source.parent.getComponent(‘Drop Reason’).selectedLabel)
system.tag.write(“Downtime_Reporting/DT_Description”,event.source.parent.getComponent(‘DT Description’).text)
system.tag.write(“Downtime_Reporting/DT_Time”,event.source.parent.getComponent(‘DT Time’).intValue)

Try using a system.gui.getWindow() in your client script.

What kind of script? Tag Change? Those don’t have an event.source. What you are trying will only work in a client tag change, and only if you use getWindow() to retrieve the open window you wish to affect.
Instead, consider binding the tags of interest to custom properties of the target window’s root container. Then you can use event.source in a propertyChange event. As a bonus, the scripts will only run when the target window is open.