Change not moving to Review state even all taks gets closed not only created by fow but by temaplate

SayaliH
Kilo Explorer

Hi,

The change is not moving to the Review state even though all change tasks are closed.

Upon verification, I found that the Change Model contains an auto-transition script that moves the change from Implement to Review. However, there is also a Before Update Business Rule that performs task validation, and the issue still persists.

The root cause appears to be that the OOB (Out of the Box) transition script is only checking the tasks that were created and managed by the workflow/flow. It is not validating whether all change tasks, including those created through change templates or other methods, are closed before moving the change to the Review state. How we can achieve this?

As a result, the auto-transition logic does not behave as expected when there is a mix of flow-created tasks and manually/template-created tasks. The change remains in the Implement state even after all tasks are eventually closed.

 

OOB script:

(function (current) {
    var ga = new GlideAggregate("change_task");
    ga.addQuery("change_request", current.sys_id);
    ga.addQuery("active", 1);
    var qc1 = ga.addQuery("created_from", "workflow");
    qc1.addOrCondition("created_from", "flow");
    ga.query();
    return ga.getRowCount() === 0;
})(current);
Before update BR on change request:
(function executeRule(current, previous /*null when async*/) {

var ctask = new GlideRecord('change_task');
ctask.addQuery('change_request', current.sys_id);
ctask.addEncodedQuery("state!=3^OR^state!=4");
ctask.query();
if(ctask.next()){
gs.addErrorMessage("Please close the Open Tasks before moving to Review state");
current.setAbortAction(true);
action.setRedirectURL(current);
}
})(current, previous);
0 REPLIES 0