Auto Close Change Request from review state
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 10:42 PM - edited ‎12-04-2023 10:56 PM
Hello,
I want to auto close the change from review state, when all its associated tasks are closed.
How can I achieve this??
Thanks in advance!!
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 11:07 PM
you can use after update BR on change task and handle this.
Check if all Change tasks for this CHG are closed or not and then close CHG
what did you start and where are you stuck?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2023 02:31 AM
(function executeRule(current, previous /*null when async*/) {
var ctask = new GlideRecord('change_task');
ctask.addEncodedQuery('state=3^change_request='+current.change_request);
ctask.query();
if (!ctask.next())
{
var change = new GlideRecord('change_request');
change.addQuery('sys_id', current.change_request);
change.query();
if (change.next())
{
change.state = 3;
change.update();
}
}
})(current, previous);