How can I replace multiple variables with one variable set for multiple catalog items?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 02:27 AM
There are multiple variables with the name 'comment' or 'comments' and every variable has been created under different catalog items. I could see 332 variables under the same name. I need to replace all these variables with one variable set under the name comments. Please help regarding this.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 02:30 AM
Hi,
then associate those variables to a variable set
Then link that variable set to the catalog items you want
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2022 08:52 PM
I have shared solution for the short cut 2 years ago
Including the variable set in multiple catalog items in one go
Sharing the script and other approach again here
1) script based
2) from UI
1) Script based: this table (io_set_item) holds the mapping of variable set and catalog item
Write this in background script
// give here the catalog item sys_id in the array
var arr = ['catalogItem1SysId','catalogItem2SysId','catalogItem3SysId'];
var gr = new GlideRecord('io_set_item');
for(var i=0;i<arr.length;i++){
gr.initialize();
gr.sc_cat_item = arr[i];
gr.order = 100;
gr.variable_set = 'variable set sys_id'; // give here the variable set sys_id here
gr.insert();
}
2) UI Based:
1. Go to variable set and add related list 'Included in' on form if its not already there
2. Click on edit button on the related list
3. There you can select all your items at once. Use filters to narrow down the list
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 10:58 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 02:33 AM
Hi Guna,
You can start by creating a variable set. And create the variable with name as 'comment(s)' under the variable set. Then go to each of your catalog item and select the variable set section and by clicking on edit button you can bring this variable set on your catalog item.
Please mark this correct and helpful based on the impact.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)