# NamedQuery to return PK value after inserting row

**URL:** <https://forum.inductiveautomation.com/t/namedquery-to-return-pk-value-after-inserting-row/81405>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 2, 2023, 6:02pm UTC](https://forum.inductiveautomation.com/t/namedquery-to-return-pk-value-after-inserting-row/81405 "2023-11-02T18:02:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbb5310](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jbb5310](https://forum.inductiveautomation.com/u/jbb5310)\
**Post date:** [November 2, 2023, 6:02pm UTC](https://forum.inductiveautomation.com/t/namedquery-to-return-pk-value-after-inserting-row/81405/1 "2023-11-02T18:02:22Z")

</div>

Can I have a named query that inserts a row and returns the primary key created?  
I

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 2, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/namedquery-to-return-pk-value-after-inserting-row/81405/2 "2023-11-02T18:28:58Z")

</div>

Already supported, when called from a script. By using the optional `getKey` boolean argument in the function call. Effectively the same as for `runUpdateQuery` and `runPrepUpdate` when not using named queries.
