The CreatorCon Call for Content is officially open! Get started here.

Import set table.

Alex153
Tera Contributor

Hi guys,

I am trying to create import set table using script

var importSetTable = new sn_impex.GlideImportSetTable("Stage_table_81");
  //var importsettable = new sn_impex.
importSetTable.addStringColumn('s_column', 50);
//importSetTable.addStringColumn('last name', 50);
var tableStructure = importSetTable.create();

But I got an error "Error: Stage_table_81 is not a valid table"

can you please help with it?

5 REPLIES 5

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Alex,

If importing from outside ServiceNow, consider using Import Set API's POST method. There's a sample using curl command in the page. The POST can also be done with other methods like calling it from JavaScript, Python, PowerScript.

https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/c_ImportSetAPI#import-POST-insertM...

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Alex,

Data can be imported into existing import set table using Import Set API's POST method. There's a sample using curl command in the page. The POST can also be done with other methods like calling it from JavaScript, Python, PowerScript.

https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/c_ImportSetAPI#import-POST-insertM...

As to creating a new import set table each time, I won't recommend it because it may create many tables and it would also require setting up transform map each time to import the data into ServiceNow table.

If the data is going to be imported periodically, Scheduled Imports may be used.

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/import-sets/task...

If it needs to be pushed, would recommend considering using Import Set API.

Hi Hitoshi,

Thanks for reply. But I have to create import set table to use it in my other scripts to import data.