Skip to content

Fix script update variable #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Fix scripts/Mass Update RITM Variable/Update RITM Variable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//use this script to update a variable value on one or more RITM records
var ritm = new GlideRecord('sc_req_item');
//ritm.addQuery... to return one or a subset of records
ritm.query();
while(ritm.next()){
var mtom = new GlideRecord('sc_item_option_mtom');
mtom.addQuery('request_item', ritm.sys_id.toString());
mtom.addQuery('sc_item_option.item_option_new', '92bdf4be97857d189d0372e11153af08'); //sys_id of a specific variable to update
mtom.query();
if(mtom.next()){
var item = new GlideRecord('sc_item_option');
item.addQuery('sys_id', mtom.sc_item_option.toString());
item.query();
if(item.next()){
item.value = '83d36f44974d71909d0372e11153af5f'; //new value to be assigned, depending on variable type (reference type used here)
item.update();
}
}
}
1 change: 1 addition & 0 deletions Fix scripts/Mass Update RITM Variable/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use this Fix Script to update a variable value on one or more RITM records
Loading