Add new variable to existing RITM (requested item)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2017 06:49 AM
Hi,
We need to add some variable to a certain catalog item. by default, the new variables will be added only to newly created requested item.
Does anyone know how can we add the new variables to existing RITM?
Appreciate some help with a script that can do that.
Thank you!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2018 08:38 AM
The above did not work for me. I had to create the item option and the mtom relationship before I could add the variable to the ritm:
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', '<MY TARGET RITM TO UPDATE WITH NEW VARIABLE>');
gr.query()
if(gr.next()){
gs.print(gr.number+' '+gr.cat_item.name)
// create option
var gr2 = new GlideRecord('sc_item_option');
gr2.initialize();
gr2.item_option_new = '<sys_id if variable as found in item_option_new>';
gr2.value = '<desired variable value>';
var id = gr2.insert();
// create mtom relationship
gr2 = new GlideRecord('sc_item_option_mtom');
gr2.initialize();
gr2.request_item = gr.sys_id;
gr2.request_item.cat_item = gr.cat_item;
gr2.sc_item_option = id;
gr2.insert();
gr.variables.<variable name as defined in item_option_new record> = '<desired variable value>';
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2019 12:54 AM
This worked perfectly. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2020 09:45 PM
Kevin just wanted to thank you so much for this - VERY HELPFUL. Thank you. IT WORKED.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2020 12:31 PM
Thanks
This is the script to update one RITM.
So if I need to update existing RITMS in bulk is that possible?
Thanks,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2021 02:24 PM
Can you please help to get these variables to catalog task level as well?