File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Server-Side Components/Business Rules/Move attachment from variable to record Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ ( function executeRule ( current , previous /*null when async*/ ) {
2+
3+ // Find attachments linked to variables (table_sys_id of RITM's variables)
4+ var attGR = new GlideRecord ( 'sys_attachment' ) ;
5+ attGR . addQuery ( 'table_sys_id' , current . sys_id ) ; // attachment originally linked to variable of this RITM
6+ attGR . addQuery ( 'table_name' , '!=' , 'sc_req_item' ) ; // exclude already moved attachments
7+ attGR . query ( ) ;
8+
9+ while ( attGR . next ( ) ) {
10+ gs . info ( 'Moving attachment: ' + attGR . file_name ) ;
11+
12+ // Update to associate with the RITM record
13+ attGR . table_name = 'sc_req_item' ;
14+ attGR . table_sys_id = current . sys_id ;
15+ attGR . update ( ) ;
16+ }
17+
18+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments