Skip to content

Commit b44af5c

Browse files
Before_BR.js
Before Update BR
1 parent 06c5594 commit b44af5c

File tree

1 file changed

+14
-0
lines changed
  • Server-Side Components/Business Rules/Prevent closure if change tasks are open

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function executeRule(current, previous /*null when async*/){
2+
if(current.close_code){
3+
var taskGR = new GlideRecord('change_task');
4+
taskGR.addQuery('change_request', current.sys_id);
5+
taskGR.addQuery('state', '!=', '3') // Adjust as needed
6+
taskGR.query();
7+
8+
if (taskGR.hasNext()){
9+
gs.addErrorMessage('You cannot close this change request until all change tasks are closed.');
10+
current.setAbortAction(true); // Prevent saving the form
11+
}
12+
}
13+
14+
})(current, previous);

0 commit comments

Comments
 (0)