Upload data with an excel file through record producer

Chaitanya Redd1
Tera Guru

Hello Team,

I'm trying to upload data through excel file using record producer but it's not working with below script. It's  redirecting to data source I can see that excel file not got loaded.

var transformMapSysIDs = 'dda3bc40dbd69050e8848f104a96193d';
current.name = gs.getUserName() + " UserImport at: " + new GlideDateTime();
current.import_set_table_name = 'u_r2p_rework_data_load'; //Name of your import table
current.file_retrieval_method = "Attachment";
current.type = "File";
current.format = "Excel";
current.header_row = 1;
current.sheet_number = 1;
current.insert(); 
 
 
var loader = new GlideImportSetLoader();
var importSetRec = loader.getImportSetGr(current);
var ranload = loader.loadImportSetTable(importSetRec, current);
importSetRec.state = "loaded";
importSetRec.update();
 
 
var transformWorker = new GlideImportSetTransformerWorker(importSetRec.sys_id, transformMapSysIDs);
transformWorker.setBackground(true);
transformWorker.start();
//To avoid to create another data source we abort the RP insert.
current.setAbortAction(true);
 
Can anyone help me where I went wrong in this script. Record producer & Transform map is on Global.
 
Thanks,
Chaitanya
12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can refer my article below that should help you

Data load and transform via Catalog Item

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

You can see below image i'm trying xls to import data directly as soon as I attach the xls and submit. Few days back it was working but don't know today I was testing before move it to prod then I found that i'm getting the issue.

 

find_real_file.png

 

Thanks,

Chaitanya

Hi,

Is this something custom you have written or it is OOB?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

This one is custom one which I have took help from many other links. But don't no it's not working.

Thanks

Chaitanya