Update Business service for a closed incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 10:54 AM
Hi,
I have a bunch of closed incidents for which the business service is marked incorrectly or left blank. Is there a way to update the business service field for a closed incident.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2024 03:52 AM
@RAJIV MENON Please use fix script to update the records.
var gr = new GlideRecord('<table name>');
gr.addEncodedQuery('the query for the tasks that needs to be updated.'); //In case all the "Closed" incidents needs to be updated with same value. If not group it accordingly and update.
gr.query();
gs.log("Rows count: " +gr.getRowCount()); //Validate if it matches as per the query results.
while(gr.next()){
gr.<fieldname> = "<sys_id_of_the_business_service";
gr.setWorkflow(false);
gr.update();
}
Reference : https://www.servicenow.com/docs/bundle/xanadu-application-development/page/build/applications/concep...
Note: You can use background scripts as well but its preferably "Fix scripts".
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2024 04:21 AM
Try the System Data Management -> Update Jobs in the left nav for a condition-based, script-less approach, with the ability to rollback!