File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Server-Side Components/Business Rules/Prevent closure if change tasks are open Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 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 ) ;
Original file line number Diff line number Diff line change 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 .
You can’t perform that action at this time.
0 commit comments