Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Import set table

newbiedeveloper
Giga Contributor

Hi All,

We have a datasource set up which runs and create new ISET num on daily basis in import set table.

Is there a way I can query the import set table to get the latest one created by my datasource and then transform the data to a existing SNOW table?

Can someone please help with how to script this may b using an UI Action?

Thanks

Subhara

1 ACCEPTED SOLUTION

Please re-review my Consumerize data load blog entry.   My code includes updating the import set rows with the task number after processing the data source and before running the transform:



// Process excel file  


var loader = new GlideImportSetLoader();  


var importSetRec = loader.getImportSetGr(current);  


var ranload = loader.loadImportSetTable(importSetRec, current);  


importSetRec.state = "loaded";  


importSetRec.update();  


 


// Update processed rows with task sys_id  


var importSetRow = new GlideRecord(importSetTableName);  


importSetRow.addQuery("sys_import_set", importSetRec.sys_id);  


importSetRow.query();  


while (importSetRow.next()) {  


      importSetRow[importSetTaskIDFieldName] = producer.task_number;  


      importSetRow.update();  


}  


 


// Transform import set  


var transformWorker = new GlideImportSetTransformerWorker(importSetRec.sys_id, transformMapID);  


transformWorker.setBackground(true);  


transformWorker.start();  


View solution in original post

9 REPLIES 9

Thanks Michael.


One basic question -


The import set table that we create , will that also get cleared like other import set tables in 7 days??


Yes it should get cleared automatically.   Though you can configure that behavior too.


Hi Michael,



I want to show a message once the load is completed. But if i write in the UI Action itself to check the sys_import_set table and see if the state is processed it dont work, it shows the state as loaded there.



Is there a way we can achieve that?


Unfortunately the load is happening via background process so you cannot show a message in the foreground to the use that the load is complete.


Thanks. This helps.