Update user record from workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 06:53 AM
Hello everyone,
I have a catalog item with a workflow attached.
After one of the tasks is closed in the workflow, I need to update the sys_user table (user record). There is a checkbox field called "sensitive_employee" that I want to be checked.
So on the catalog item form, there is a "Requested For" variable, and the user record for that person is where this update needs to happen.
So far I have a run script activity in the workflow that looks like this, but now luck. Any ideas? thanks!
var gr =new gliderecord("sys_user");
var ga = "u_sensitive_employee";
ga.setValue("u_sensitive_employee", 'true');
gr.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 07:00 AM
You almost have it, I corrected the script below. You may need to adjust the field names to match, I was yours
var userVar = current.variables.requested_for
var userUpdate = new GlideRecord("sys_user");
userUpdate.addQuery('sys_id', userVar)
userUpdate.query()
if(userUpdate.next()){
userUpdate.u_sensitive_employee = true
userUpdate.update();
}
If this solved your issue, please mark this correct and helpful, thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 07:01 AM
Hi there,
Try updating your script as below:
var userGr = new GlideRecord("sys_user");
if (userGr.get(current.variables.requested_for.toString())) {
userGr.setValue("u_sensitive_employee", true);
userGr.update();
}
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 07:22 AM
Thank you! This works perfectly 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 07:24 AM
Glad to hear it 🙂
Please mark my answer as correct and helpful to close this thread.
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry