diff --git a/Client-Side Components/UI Actions/CloseAllChildCases/CloseAllChildCases.js b/Client-Side Components/UI Actions/CloseAllChildCases/CloseAllChildCases.js new file mode 100644 index 0000000000..50e8a34515 --- /dev/null +++ b/Client-Side Components/UI Actions/CloseAllChildCases/CloseAllChildCases.js @@ -0,0 +1,15 @@ +var gr = new GlideRecord('sn_customerservice_case'); +gr.addQuery('parent', current.sys_id); +gr.query(); +var counter = 0; +while (gr.next()) { + if (gr.state != 3) { + gr.resolution_code = '16'; + gr.close_notes = 'This case was auto closed from the parent case.'; + gr.state = '3'; + gr.update(); + counter++; + } +} +gs.addInfoMessage(counter + ' cases have been closed.'); +action.setRedirectURL(current); diff --git a/Client-Side Components/UI Actions/CloseAllChildCases/README.md b/Client-Side Components/UI Actions/CloseAllChildCases/README.md new file mode 100644 index 0000000000..acebd5e82d --- /dev/null +++ b/Client-Side Components/UI Actions/CloseAllChildCases/README.md @@ -0,0 +1,6 @@ +Name: Close all Child Case +Table:sn_customerservice_case +Condition: (gs.hasRole('sn_customerservice_agent') || gs.hasRole('admin') ) + +Use Case: +Provide UI action button to close all the associated child cases from the parent Case.