- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 08:34 AM
Hi,
There are 52 drop down values for a variable in an Catalog item, now we need to rename only 17 values to a new name. Already there are many request logged into the system with those 17 values. When I tried renaming it in the catalog item ( both display name as well as backend value) it got renamed in the variable drop down, unfortunately the modified name is not appearing in existing tickets, instead it is populating old values (back end value).
Data type of the variable in Catalog item : Select box
Inshort : Renamed name is not appearing in existing ticket, instead it is showing old values back end value or it is becoming empty.
Please suggest how i can make the modified name to replicate in all existing tickets
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 12:19 AM
Hi Brad,
Thanks for your reply, however we didn't use script because we had a requirement to rename 20 + choices, so to rename 20 choices we was supposed to run the above script 20 times so we didn't went with it.
Solution Implemented:
We just changed the Display name of the choices( we didn't change the back end value), by renaming the display name alone, the renamed name got replicated automatically in existing tickets.
Thanks,
Kalanidhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 08:58 AM
You'll need to run a background or fix script to recast these values. Here is an example I have executed. You will need to adjust this to fit your scenario, but this is the structure. Just so that you can follow along my example, I needed to populate a (reference) variable named v_asset on every RITM for the 'Build Network Gear' catalog item where this variable was blank. I populated them all with one certain record from the asset table. It sounds like once you return the mtom record matching one old value, you would still GR sc_item_option since that is ultimately the record that needs to be updated, but then once you return the item record you can just update the item.value to the new choice list value. Then you'd have to go through this all 16 more times for the other variables. Have fun!
var ritm = new GlideRecord('sc_req_item');//first return every RITM for Build Network Gear
ritm.addQuery('cat_item', 'b1b3a1abdbf807004a29df6b5e961964');//Build Network Gear
ritm.query();
while(ritm.next()){
var mtom = new GlideRecord('sc_item_option_mtom');//For each RITM, find ones where v_asset is wrong (empty)
mtom.addQuery('request_item', ritm.sys_id.toString());
mtom.addQuery('sc_item_option.item_option_new', '12c018fbdb458b0084b85d6e5e9619ff');//v_asset
mtom.addQuery('sc_item_option.value', '');
mtom.query();
if(mtom.next()){
var item = new GlideRecord('sc_item_option');//this is the table record where the update happens
item.addQuery('sys_id', mtom.sc_item_option.toString());
item.query();
if(item.next()){
var asset = new GlideRecord('alm_hardware');//lookup the asset record to populate on these empty variables
asset.addQuery('display_name', 'CONTAINS', 'GEPRB0082040');
asset.query();
if(asset.next()){
item.value = asset.sys_id.toString();
item.update();
}
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 09:05 AM
Hi Kalanidhi,
Reason being those are already entered in database & thus will show old value only. If this is to be changed then you need to look for question_answer (Question Answers) table & update the entries accordingly.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 09:54 AM
Hi Brad and Jaspal,
Thank you both.
Is there any way that will update all the tickets with its corresponding new value once when the Question choice value is renamed to new one ?
Thanks and Regards,
Kalanidhi Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 10:41 AM
No. By updating a Value of a Question Choice for a Select Box type variable, you are changing a record on the question_choice table, which only relates back to the variable. Once you populate variables on a request form, RITM, or catalog task, the value you've selected - whether it's a select box choice list value, reference sys_id, free text, true/false, yes/no, or whatever else - that value is only stored on the sc_item_option table, which relates back to the sc_item_option_mtom to match it up with the RITM.
As an alternative to the script, you can open a list view on the sc_item_option table and filter on Value = <<one of the old values>>, then update 100 at a time to the new value, if the old values are unique to the variable that was updated. This table is very large if you have many RITMs, so this method is usually not ideal.