User Management: onSaveUser script fails

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?

	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'

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

2 Likes

Thanks for coming back to update.

1 Like