# Gateway event script 2

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-script-2/50509>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [September 1, 2021, 12:17pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509 "2021-09-01T12:17:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikunj.pipariya](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@nikunj.pipariya](https://forum.inductiveautomation.com/u/nikunj.pipariya)\
**Post date:** [September 1, 2021, 12:17pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509/1 "2021-09-01T12:17:43Z")

</div>

We are facing a issue is running the gateway event script. The script is able to run in script console successfully but when the we input the same script in gateway script in schedule option, it is not showing its status or output. The screenshot of the script written is attach below. We need a assistance regarding this issue if possible.

 ![Screenshot (3)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/98522a4d503080bb824827dab0bc65a27913d6e3.png)  
 ![Screenshot (1)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/741e3becbb70f8fa0ee3302211ade6fb73bf6eb6.png)

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [September 1, 2021, 12:25pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509/2 "2021-09-01T12:25:51Z")

</div>

Can you also show us the schedule settings tab too? And you said it doesn’t show it’s status or output but can you confirm if it executes? And, just to be sure, what is the datatype of the tag you’re writing to?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [September 1, 2021, 12:28pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509/3 "2021-09-01T12:28:22Z")

</div>

You should add a logger (as a general practice to all gateway scripts imo) to make sure its running and doing what you expect.

```auto
logger = system.util.getLogger("Logger Name")
logger.info("Running gateway script")
results = system.tag.writeBlocking(tagName, value)
logger.info("Results of write: " + str(results))

```

For instance.

Also, I believe system.tag.writeBlocking requires lists even for singular values so it should be `system.tag.writeBlock(['myTag'], ['true'])`

Also, are you sure you want to be writing a String of true instead of the boolean value `true`? I don’t mean to nitpick but if this writing to a boolean tag, I think writing a string of true is not going to work.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [September 1, 2021, 1:46pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509/4 "2021-09-01T13:46:12Z")

</div>

Is the project containing that scheduled script enabled? What Ignition version are you running?

---

<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:** [September 1, 2021, 1:49pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-2/50509/5 "2021-09-01T13:49:15Z")

</div>

> [@bkarabinchak.psi](#):
>
> Also, I believe system.tag.writeBlocking requires lists even for singular values so it should be `system.tag.writeBlock(['myTag'], ['true'])`

Actually, depending on the version, single elements passed as strings will work.

> [@Attribute Error in Component Custom Method](https://forum.inductiveautomation.com/t/attribute-error-in-component-custom-method/47712/15):
>
> Fairly recently we made a sneaky change to the read and write functions to allow single elements to be passed, since it's a common 'papercut' issue for new users and our training department. The preferred syntax is still to call it with a list, but single values are accepted - that explains the syntax in the OP working. Basically correct - gateway event scripts are the only system that still uses 'legacy' scripting, and therefore needs you to reimport system inside any defined functions.
