Skip to content

Commit 84ab1d9

Browse files
authored
Create Update RITM Variable.js
1 parent b45fd85 commit 84ab1d9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//use this script to update a variable value on one or more RITM records
2+
var ritm = new GlideRecord('sc_req_item');
3+
//ritm.addQuery... to return one or a subset of records
4+
ritm.query();
5+
while(ritm.next()){
6+
var mtom = new GlideRecord('sc_item_option_mtom');
7+
mtom.addQuery('request_item', ritm.sys_id.toString());
8+
mtom.addQuery('sc_item_option.item_option_new', '92bdf4be97857d189d0372e11153af08'); //sys_id of a specific variable to update
9+
mtom.query();
10+
if(mtom.next()){
11+
var item = new GlideRecord('sc_item_option');
12+
item.addQuery('sys_id', mtom.sc_item_option.toString());
13+
item.query();
14+
if(item.next()){
15+
item.value = '83d36f44974d71909d0372e11153af5f'; //new value to be assigned, depending on variable type (reference type used here)
16+
item.update();
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)