- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Dear Experts,
I have standard changes which processes the decommission of the servers but the tasks that are created is controlled which means that the preceding task is dependent on the previous task.. but when the first task is closed after the change is moved to implement before the next task is opened, and the state changes to Review but the tasks have not even been populated and there are other tasks pending as well. It is an out of the box behaviour, but how to prevent that. Please help!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I worked on the business rule it worked to held on the implement state
(function executeRule(current, previous /*null when async*/ ) {
var review_value = '0';
// Add your code here
var activeTask = new GlideRecord("change_task");
activeTask.addQuery("change_request", current.sys_id);
activeTask.addQuery("state", "NOT IN ", "3,4,7");
activeTask.query();
if (activeTask.hasNext()) {
current.setAbortAction(true);
return;
}
var activeFlow = new GlideRecord("sys_flow_context");
activeFlow.addQuery("source_record", current.sys_id);
activeFlow.addQuery("state", "IN", "IN_PROGRESS,WAITING,QUEUED");
activeFlow.query();
if (activeFlow.hasNext()) {
current.setAbortAction(true);
return;
}
current.state = review_value;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I think BR is needed here mate
Regards
Dr Atul G. - Learn N Grow Together ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
******************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I worked on the business rule it worked to held on the implement state
(function executeRule(current, previous /*null when async*/ ) {
var review_value = '0';
// Add your code here
var activeTask = new GlideRecord("change_task");
activeTask.addQuery("change_request", current.sys_id);
activeTask.addQuery("state", "NOT IN ", "3,4,7");
activeTask.query();
if (activeTask.hasNext()) {
current.setAbortAction(true);
return;
}
var activeFlow = new GlideRecord("sys_flow_context");
activeFlow.addQuery("source_record", current.sys_id);
activeFlow.addQuery("state", "IN", "IN_PROGRESS,WAITING,QUEUED");
activeFlow.query();
if (activeFlow.hasNext()) {
current.setAbortAction(true);
return;
}
current.state = review_value;
})(current, previous);
