# User Management: onSaveUser script fails

**URL:** <https://forum.inductiveautomation.com/t/user-management-onsaveuser-script-fails/28086>\
**Category:** Ignition\
**Created:** [September 6, 2019, 7:52pm UTC](https://forum.inductiveautomation.com/t/user-management-onsaveuser-script-fails/28086 "2019-09-06T19:52:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 6, 2019, 7:52pm UTC](https://forum.inductiveautomation.com/t/user-management-onsaveuser-script-fails/28086/1 "2019-09-06T19:52:20Z")

</div>

This works on a button, but the udt fails inside the user management `onSaveUser` extension function. Does it have anything to do with it being a background thread?

```auto
	user = user.get('username')
	tagPath = 'Sewing/users/%s' % (user)
	print tagPath
	exists = system.tag.exists(tagPath)
	if exists:
		return
	else:
		# Add UDT instance tag
		try:
			laborCategory = '2515'
			system.tag.addTag(parentPath='[default]Sewing/users', name=user, tagType="UDT_INST", attributes={"UDTParentType":'sewingMachine'}, overrides={"laborCategory":{"Value":laborCategory}})
			print 'udt created'
		except:
			print 'udt failed'

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 6, 2019, 8:42pm UTC](https://forum.inductiveautomation.com/t/user-management-onsaveuser-script-fails/28086/2 "2019-09-06T20:42:47Z")

</div>

Dang, I didn’t have tag editing permissions enabled for the client ☹

---

<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:** [September 6, 2019, 8:43pm UTC](https://forum.inductiveautomation.com/t/user-management-onsaveuser-script-fails/28086/3 "2019-09-06T20:43:34Z")

</div>

Thanks for coming back to update.
