File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Server-Side Components/Scheduled Jobs/Bucket Group Reporting Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ var rec = new GlideRecord ( 'case' ) ; // any table which you want to use
2+ rec . addEncodedQuery ( 'stateNOT IN60,40, 20' ) ; // filtering out all the closed/cancelled cases
3+ rec . query ( ) ;
4+ while ( rec . next ( ) ) {
5+ var openedDate = new GlideDateTime ( rec . opened_at . getDisplayValue ( ) ) ;
6+ var dur = GlideDateTime . subtract ( openedDate , actualDateTime ) ;
7+ //gs.info("dur"+dur.getNumericValue()) ;
8+ elapsedTime = dur . getNumericValue ( ) / 86400000 ;
9+ // gs.info ("elapsedTime" + elapsedTime)
10+ // Check to see when the item was created
11+ if ( elapsedTime <= 2 ) aging = '0-2 Days' ;
12+ if ( elapsedTime > 2 ) aging = '3-4 Days' ;
13+ if ( elapsedTime > 4 ) aging = '5-7 Days' ;
14+ if ( elapsedTime > 7 ) aging = '8-15 Days' ;
15+ if ( elapsedTime > 15 ) aging = '16-30 Days' ;
16+ if ( elapsedTime > 30 ) aging = '31-60 Days' ;
17+ if ( elapsedTime > 60 ) aging = '61-90 Days' ;
18+ if ( elapsedTime > 90 ) aging = 'Over 90 Days' ;
19+
20+ rec . setWorkflow ( false ) ; // Skip any Business Rules
21+ rec . autoSysFields ( false ) ; // Do not update system fields
22+ rec . aging_category = aging ;
23+ rec . update ( ) ;
24+ }
You can’t perform that action at this time.
0 commit comments