# Gateway event script sometimes fails to execute a function

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-script-sometimes-fails-to-execute-a-function/36539>\
**Category:** Ignition\
**Created:** [July 9, 2020, 1:36pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-sometimes-fails-to-execute-a-function/36539 "2020-07-09T13:36:04Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [July 9, 2020, 11:48pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-sometimes-fails-to-execute-a-function/36539/17 "2020-07-09T23:48:02Z")

</div>

> [@pturmel](#):
>
> The ‘project’ argument should have been _ **after** _ path and parameters, and optional in project contexts. I’d love to see it deprecated, with the replacement as above.

I’ve got to agree with this. From a users perspective, runNamedQuery() is unnecessarily quirky.

> [@beginNamedQueryTransaction requires undocumented 'project' argument in gateway scope](http://forum.inductiveautomation.com/t/beginnamedquerytransaction-requires-undocumented-project-argument-in-gateway-scope/34135/3):
>
> I think this is the source of some confusion. In the gateway, you know the project when the caller is a gateway event script. You don’t know the project when called from a tag event. The corresponding scripting functions in system.db.\* that have a datasource argument should have been the model for the named query functions. These functions take an optional datasource in client and gateway project scopes, but the argument is mandatory in gateway non-project scope. Arguably, with v8’s new gl…

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-event-script-sometimes-fails-to-execute-a-function/36539)._
