Bulk import data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I am trying to create a catalog item record in which there are nearly 400 + Variable options needs to be created.
Is there a way I can do a bulk import of this data rather than creating each variable option manually.
If yes,what is it?
Considering I have to further it to other higher enriovnments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
This can be done via a Fix Script, but it will require you to build an array of choices to insert into the question_choice table. A much better option is to import the data directly into the question_choice table using an Excel sheet or another data source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
hey @shivanib56
Yes, there are several supported approaches for creating a large number of Catalog Variables without manually creating each one.
1. Import Set + Transform Map
If you already have the variable definitions in an Excel or CSV file, import the data into a staging table using System Import Sets > Load Data.
Then, use a Transform Map (or an onAfter Transform Script, if needed) to create records in:
item_option_new – Catalog Variables
question_choice – Choice values for Select Box, Multiple Choice, Lookup Select Box, etc.
This is a reusable and scalable approach, making it ideal for creating hundreds of variables.
2. Background Script / Fix Script
Another common approach is to import the Excel data into a custom staging table and then use a Background Script or Fix Script to create the variables programmatically.
Script:
var gr = new GlideRecord('item_option_new');
gr.initialize();
gr.cat_item = '<Catalog Item Sys ID>';
gr.name = 'employee_id';
gr.question_text = 'Employee ID';
gr.type = 1; // Single Line Text
gr.order = 100;
gr.mandatory = true;
gr.insert();
If your variables include choice values, you'll also need to create corresponding records in the question_choice table and associate them with the appropriate variable.
This method provides complete control over validation, error handling, and custom logic.
3. XML Export / Import
If the variables already exist in another instance, you can:
Export the variable records as XML.
Import them into the target instance.
This is suitable for one-time migrations but is generally not recommended for ongoing deployments.
4. Update Sets
Once the variables have been created in your development instance, promote them to higher environments using:
Update Sets
Application Repository (for scoped applications)
This is the recommended deployment method instead of recreating the variables manually in each environment.
5. IntegrationHub ETL or Scripted Imports
If the variable definitions originate from an external system, you can also leverage IntegrationHub ETL or a custom scripted import process to create the variables.
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb