File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Server-Side Components/Business Rules/Sync Integer Field Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ // Business Rule: 'Before' Update on any table that will have a integer field you want to keep in sync
2+ ( function executeRule ( current , previous /*null when async*/ ) {
3+ var tableName = current . getTableName ( )
4+
5+ //This array will contain the list of records with their current value before rearranging them.
6+ var recordList = [ ] ;
7+
8+ var tableRecord = new GlideRecord ( tableName ) ;
9+ tableRecord . addNotNullQuery ( { { insert name of integer field you want to sync} } ) ; //Going to exclude records that don't have a value
10+ tableRecord . addQuery ( 'sys_id' , '!=' , current . sys_id ) ; //Need to exclude the current record
11+ tableRecord . orderBy ( { { insert name of integer field you want to sync} } ) ;
12+ tableRecord . query ( ) ;
13+
14+ while ( tableRecord . next ( ) ) {
15+ projectList . push ( tableRecord . sys_id . toString ( ) ) ;
16+ }
17+
18+
19+
20+
21+
22+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments