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

Hey,

I have already posted the video link and he has written the same code given by you from that video. Still it is not working for him.

So, could you please tell us what could be the issue?

Thanks.

VASS1
Kilo Expert

Hi Onkar,

Is it working for you? 

I have done the same and when i submit the Record producer its asking Name and Importset table name, eventhough its mentioned in the code.

Any clue?

Current.name ="Incidents";
Current.Import_set_Table_name = "u_incidents_load"; //Name of your import table
Current.file_retrieval_method = "Attachment";
Current.type = "File";
Current.format = "CSV";
Current.header_row=1;
Current.sheet_number = 1;
Current.insert(); //Need this since we want to load and transform directly 

Thanks

Srinivas

mballinger
Mega Guru

I know this is pretty late, but make sure your RP references the sys_data_source table. I ran into the same issue and it worked after changing table on RP