- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 04:56 AM
I need a little help to try and work out why a glide record I have created is taking a long time to process.
Background - I've set up a request for ServiceNow access. Part of this request is to replace an existing persons license, so I am capturing the revoke date on the request (revoke_date). I want to update the user record with this date (u_revoke_on - this is a manual field on the sys_user table) from the workflow.
I originally tried this:
current.user.u_revoke_on = current.variables.revoke_date;
but it didn't work, so I added a script in:
var gr = new GlideRecord('sys_user');
gr.addQuery('user' , '=', current.variables.replacing_user);
gr.query();
while(gr.next())
{
gr.u_revoke_on = current.variables.revoke_date;
gr.update();
}
This works, but for some reason it takes ages to set the request up. (If I remove it its instant)
Can anyone help me find out why when I include this in my workflow it takes ages?
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 05:33 AM
Its updating all records thats why its taking so long, I changed the query to be sys_id instead of name and it now works ok
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id' , current.variables.replacing_user);
gr.query();
while(gr.next())
{
gr.u_revoke_on = current.variables.revoke_date;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2015 05:33 AM
Its updating all records thats why its taking so long, I changed the query to be sys_id instead of name and it now works ok
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id' , current.variables.replacing_user);
gr.query();
while(gr.next())
{
gr.u_revoke_on = current.variables.revoke_date;
gr.update();
}