Run Auto Transform Map when RP submitted excel file

Shekhar Deshin1
Mega Guru

Hi,

 

I am trying to set up Auto run transform map when any user submitted record producer as attachment excel data to load to the target table.It should run the auto transform map and load data to target table.

in following code i am trying it in my PDI but failed to run Auto transform map.I can see excel sheet attached to data sources first part of code is running but failed in loader part.Is this functionality still using in ServiceNow ?

 

var transformMapsysID = 'sys_id'; (trnasform map sysid)

 

current.name = gs.getUserName() + "UserImport at: " + new GlideDateTime();
current.import_set_table_name = 'u_import_record_producer';//Name of Import Set Table
current.file_retrieval_method = "Attachment";
current.type = "File";
curent.format = "Excel";
current.header_row = 1;
current.sheet_number = 1;
current.insert(); //Need this since we want to load and transform directly

 

//Now it time to load the excel file into the import table

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,transformMapsysID);
transformworker.setBackground(true);
transformworker.start();

--------------------------------------------

Please suggest,

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Shekhar Deshin1 

check these links for GlideImportSetLoader

Response from fabian in this link

Usage of GlideImportSetLoader & GlideImportSetTransformerWorker API's from scoped Application 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

You mean this is not working in scope application and record producer.

Thanks,

 

 

@Shekhar Deshin1 

Did you check that link?

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

Yes I checked however i am not getting exact context on that.