# Configured Event onActionPerformed Script Run NamedQuery

**URL:** <https://forum.inductiveautomation.com/t/configured-event-onactionperformed-script-run-namedquery/93675>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 24, 2024, 2:52pm UTC](https://forum.inductiveautomation.com/t/configured-event-onactionperformed-script-run-namedquery/93675 "2024-07-24T14:52:01Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 24, 2024, 3:58pm UTC](https://forum.inductiveautomation.com/t/configured-event-onactionperformed-script-run-namedquery/93675/9 "2024-07-24T15:58:59Z")

</div>

Consider also refactoring your code like this, to dramatically reduce duplication (and opportunities for typos to slip in):

```python
def runAction(self, event):
    path = 'Refrigeration/ChillerWOEntry'
    params = {
        "chillerID": self.parent.custom.ChillerID,
        "chillerName": self.getSibling("ChillerName").props.text,
        "wo": self.getSibling("WorkOrder").props.value,
        "fromTank": self.getSibling("StartTank").props.value,
        "toTank": self.getSibling("EndTank").props.value,
        "extraTank1": self.getSibling("EndTank1").props.value,
        "extraTank2": self.getSibling("EndTank2").props.value,
        "lot": self.getSibling("LotNumber").props.text,
        "feedtype": self.getSibling("FeedType").props.text,
        "prodtempmin": self.getSibling("ProdTempMin").props.value,
        "prodtempmax": self.getSibling("ProdTempMin").props.value,
        "jobtype": self.getSibling("JobType").props.value,
        "status": self.getSibling("Status").props.value,
        "statusreason": self.getSibling("StatusReason").props.value,
        "comment": self.getSibling("Comments").props.text,
        "timestamp": self.getSibling("LogDate").props.text,
        "dt": self.getSibling("MonthYear").props.text,
        "user": self.session.props.auth.user.userName
    }
        
    system.db.runNamedQuery(path, params)

```

Consider also reading though this thread, especially this post in particular:

> [@Do's and Don'ts when developing First Project with Ignition?](https://forum.inductiveautomation.com/t/dos-and-donts-when-developing-first-project-with-ignition/93592/5):
>
> Bind UI input values to custom properties of the view, and reference those instead of the input value itself. It not only makes for cleaner code without a bunch of getChild/getSibling nonsense with hardwired component names, but ensures that you can reorganize and rename components without breaking those references. Name your UI components/containers. It may seem like unnecessary effort in the short term, but in the long term it will save lots of hassle when trying to navigate your way down t…

---

_[View the full topic](https://forum.inductiveautomation.com/t/configured-event-onactionperformed-script-run-namedquery/93675)._
