- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2015 01:16 PM
I receive numerous requests to manually activate user records in ServiceNow, ie set active=true, and locked_out=false, so that HR can complete termination tasks. They need the account active for a short amount of time. The user record will get updated anyway on the next import/update from AD.
I would like to do it from a catalog item, which HR can initiate themselves, so that I have a record. I created an item, and a workflow to go with it. The workflow activity (definition= run script) is where I am coming unstuck.
The variable on the item is 'activate_user', a reference to the sys_user table.
In the run script workflow activity, I would like to have the script activate the user, specified in the activate _user variable.
The script should be simple shouldn't it? Something like:
var user = current.variable_pool.activate_user;
user.active=true;
user.locked_out=false;
user.update();*/
Or would I have to build a query to query the user table for the user first? Also, I think there may be an ACL involved to, to allow HR to update the user record. Maybe there is a better solution? A custom application? Appreciate any help. Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2015 03:22 PM
Your variable contains the sys_id of the User record. You will need to use something like:
onSubmit(){
var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
alert (caller.name + " is active now ");
}
See Wiki on getReference:
GlideForm (g form) - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2015 03:22 PM
Your variable contains the sys_id of the User record. You will need to use something like:
onSubmit(){
var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
alert (caller.name + " is active now ");
}
See Wiki on getReference:
GlideForm (g form) - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 08:56 AM
Used the following based on reply:
function onSubmit(){
var caller = g_form.getReference('activate_user', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
alert (caller.name + " will be active for 2 hours only ");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 08:57 AM
Thanks....appreciate it.