How to import data from CSV file source to create a catalog item?

ishaanvohra
Kilo Contributor

Hi,

I want to import bulk data from CSV file source to create a new catalog items and want to have the attributes in my file to be the variables of the catalog item.

For this, I have created an import set and have also created a source table from which data will transform into my target table.I have also created a transform map.I want to add variable,category and catalog in the catalog item.And I also want to add the deafult values in the variables.As for each catalog items the variables will be same but their default values will be different.

So I want to run a script in the transform map.How can I do that with a script so that a new catalog item will get generate and variable set,categories will get provided to   it.

How can this be done with the help of the script.How can I bulk import data to create new catalog items?

6 REPLIES 6

Hi Ishaan,



If you want to do this way, then you have to proceed this way:



  1. Create a data source with attachment type and attach the CSV
  2. Create an import set table for pulling all the columns in CSV to staging table attributes.
  3. Create transform map for mapping all the attributes in the catalog item table (sc_cat_item)
  4. Create a OnAfter transform script something like this to create variables from the columns in your CSV.


var gr = new GlideRecord('question');


gr.initialize();


gr.question_text= source.varibale1text;


gr.name= source.variable1name;


gr.type='7';   // say for check box


gr.insert();


ersureshbe
Giga Sage
Giga Sage

Hi Ishaan,

I'm having same requirement. Did you achieved it? If yes, Can you give the guidance. 

Regards,

Suresh Loganathan.

Regards,
Suresh.