File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Server-Side Components/Business Rules/Validate Checklist items Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ //Business Rule: before update on the escalation table (custom)
2+ ( function executeRule ( current , previous /*null when async*/ ) {
3+ var checklistGR = new GlideRecord ( "checklist" ) ;
4+ checklistGR . addQuery ( "document" , current . sys_id ) ;
5+ checklistGR . query ( ) ;
6+
7+ while ( checklistGR . next ( ) ) {
8+ var itemGR = new GlideRecord ( "checklist_item" ) ;
9+ itemGR . addQuery ( "checklist" , checklistGR . sys_id ) ;
10+ itemGR . addQuery ( "complete" , false ) ;
11+ itemGR . query ( ) ;
12+
13+ if ( itemGR . hasNext ( ) ) {
14+ gs . addErrorMessage ( 'Checklist has incomplete items. Please complete all before assigning it back.' ) ;
15+ current . setAbortAction ( true ) ;
16+ break ; // stop after first failure
17+ }
18+ }
19+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments