# System tags not writing to DB on tag value change

**URL:** <https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 21, 2023, 7:54pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179 "2023-08-21T19:54:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ly17](https://avatars.discourse-cdn.com/v4/letter/l/c57346/32.png) [@Ly17](https://forum.inductiveautomation.com/u/Ly17)\
**Post date:** [August 21, 2023, 7:54pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179/1 "2023-08-21T19:54:44Z")

</div>

Hi, I'm inserting data to a DB on tag value changed. The tag below isn't writing to the DB and shows as Null.  
UserName = system.tag.readBlocking("[System]Client/User/Username")[0].value

All other tags (from default tag provider) are writing to the DB correctly, except for this one.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 21, 2023, 7:59pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179/2 "2023-08-21T19:59:57Z")

</div>

> [@Ly17](#):
>
> UserName = system.tag.readBlocking("[System]Client/User/Username")[0].value

The correct syntax would be something like:

```auto
UserName = system.tag.readBlocking(["[System]Client/User/Username"])[0].value

```

edit: nevermind, there's a special exception that allows the scalar input value to work in addition to the list. It's what Paul asked about the scope.

---

<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:** [August 21, 2023, 8:01pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179/3 "2023-08-21T20:01:25Z")

</div>

Be more specific about where you're calling this from. As in, literally on a tag's event script `valueChanged`? Because you can't read the **client** user name from that scope - you're in the wrong place.

---

<div class="post-metadata">

**Author:** ![Ly17](https://avatars.discourse-cdn.com/v4/letter/l/c57346/32.png) [@Ly17](https://forum.inductiveautomation.com/u/Ly17)\
**Post date:** [August 21, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179/4 "2023-08-21T20:03:50Z")

</div>

Yes, I'm on the tag's event script value changed. That would explain. Thanks. Would that need to be done on the Client Event Scripts with Tag Change?

---

<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:** [August 21, 2023, 8:56pm UTC](https://forum.inductiveautomation.com/t/system-tags-not-writing-to-db-on-tag-value-change/78179/5 "2023-08-21T20:56:48Z")

</div>

Yes, that's the easiest way to get that info. Note that you won't be able to attest, for instance, that the tag was modified by the user in question - that event will fire once per open client whenever the specified tag(s) change.
