Skip to content

Commit 9ce4d27

Browse files
Restrict changes to the Close state when the Change Task is open (#2442)
* Before_BR.js Before Update BR * README.md * README.md * README.md Updated
1 parent 12b0a2e commit 9ce4d27

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-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);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Prevent Closure if the change tasks are open
2+
3+
1. Create a Before Business Rule.
4+
2. Applicable to Change Request Table.
5+
3. Use Before - Update Business Rule.
6+
4. Add filter conditions if required.
7+
5. Apply the Business Rule script.
8+
6. If the change request have the active change tasks are still open then we can't proceed with the submission.
9+
7. If required we can add few more query conditions.
10+
8.

0 commit comments

Comments
 (0)