EditUser, firstname and lastname

All the information I find on EditUser are only using ContactInfo…

How do you edit the username, firstname and lastname ?


Hi @vipo, you can do it like this:

user = system.user.getUser('default', un)
user.set('firstName', fname)
user.set('lastName', lname)
err = system.user.editUser('default', user).getErrors()

Admittedly the docs for editUser are a bit lacking. I found the examples given in getNewUser more useful. The second example shows how to use the getNewUser system function and pass in the information to create the new user. Editing a user is similar, except you will be calling getUser and editUser.

@matthew.ayre thank you, I’ve been trying this several times… turned out to be a race condition for fetching the username.

1 Like

Does the user.set() method for first and last name work when using system.user.getNewUser()?

Yes it does. Check out the user manual for more details and code snippets.
system.user.getNewUser - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

1 Like