- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:43 PM
Hello everyone,
Please need your help creating a fix script that will change the assignment group from the current one to a different one from the beginning of time, I have been checking scripts but the ones I have found are just to update last year's.
This script I took it from sachin.namjoshi
var inc = new GlideRecord('incident');
inc.addEncodedQuery('sys_created_onONLast year@javascript:gs.beginningOfLastYear()@javascript:gs.endOfLastYear()');
inc.query();
while(inc.next()){
inc.assignment_group = "d625dccec0a8016700a222a0f7900d06";
inc.update();
}
what do I need to modify so that it changes all incidents?
Thank you
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:57 PM
Updated script below. Please update line no 2 with the exact sysid of the Service Desk group.
var inc = new GlideRecord('incident');
inc.addQuery('assignment_group','PASS Service Desk SYSID HERE'); //Replace PASS Service Desk SYSID HERE with the sysid of the Service Desk group
inc.query();
while(inc.next()){
inc.assignment_group = "d625dccec0a8016700a222a0f7900d06"; //Assume this is the SYSID of SD alert group
inc.setWorkflow(false); //Disables the running of business rules that might normally be triggered by subsequent actions.
inc.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:48 PM
Hi,
If I get your question correctly you need to update all incidents with the same assignment group. If yes then please try with the below script.
var inc = new GlideRecord('incident');
inc.query();
while(inc.next()){
inc.assignment_group = "d625dccec0a8016700a222a0f7900d06";
inc.setWorkflow(false); //Disables the running of business rules that might normally be triggered by subsequent actions.
inc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:53 PM
Hello Pradeep,
I don't need to change all incident assignment groups, just the ones assigned to "Service Desk"
the incidents assigned to "Service Desk" I need to change them to "SD alert"
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:57 PM
Updated script below. Please update line no 2 with the exact sysid of the Service Desk group.
var inc = new GlideRecord('incident');
inc.addQuery('assignment_group','PASS Service Desk SYSID HERE'); //Replace PASS Service Desk SYSID HERE with the sysid of the Service Desk group
inc.query();
while(inc.next()){
inc.assignment_group = "d625dccec0a8016700a222a0f7900d06"; //Assume this is the SYSID of SD alert group
inc.setWorkflow(false); //Disables the running of business rules that might normally be triggered by subsequent actions.
inc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 01:59 PM
Thanks a lot!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 02:06 PM
You are very welcome @josenava. Thank you for participating in the community.