Close the request item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2022 06:04 PM
when all the catalog tasks are closed completed, then the parent request item should be closed completed.
I wrote this business rule, can someone please look at it.
after-insert,update
(function executeRule(current, previous /*null when async*/ ) {
var flag = true;
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.request_item);
gr.query();
while (gr.next()) {
if (gr.state != '3') {
flag = false;
}
}
if (flag == true) {
var pr = new GlideRecord("sc_req_item");
pr.addQuery("number", current.request_item);
pr.query();
if (pr.next()) {
pr.state = '3';
pr.update();
}
}
})(current, previous);
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2022 06:56 PM
Hi
see the solution approach at question https://community.servicenow.com/community?id=community_question&sys_id=21a9b51cdb1eb450679499ead396...
Maik