Skip to content

Commit 29cee45

Browse files
authored
Fix script update variable (#1084)
* Create Update RITM Variable.js * Create readme.md
1 parent 7380984 commit 29cee45

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-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+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use this Fix Script to update a variable value on one or more RITM records

0 commit comments

Comments
 (0)