ImportSet Error Messages

questsal78
Giga Expert

Hi,

I'm using a record producer to import data into a custom table for updates. Everything is working fine except, I'm unable to show end user a message showing how many rows were there, how many are updated and how many ignored just like below: End user is not admin so they can only see messages via record producer.

find_real_file.png

Here is my code:

// Set the following variables with the name of your import set table and task id column

var importSetTableName = "u_integrate_renewal_orders";

var transformMapID = "xxxxxxxxxxxxx"; // removed actual sys_id with text

// Setup data source for attachment

current.name = "Renewal Import " + now();

current.import_set_table_name = importSetTableName;

current.file_retrieval_method = "Attachment";

current.type = "File";

current.format = "Excel";

current.header_row = 1;

current.sheet_number = 1;

current.insert();

// Process excel file

var loader = new GlideImportSetLoader();

var importSetRec = loader.getImportSetGr(current);

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

importSetRec.state = "loaded";

importSetRec.update();


// Transform import set

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

transformWorker.setBackground(true);

transformWorker.start();

// Take user to task

gs.addInfoMessage("Data import may take time load, please reload record to see all the assets.");



// Since we inserted data source already, abort additional insert by record producer

current.setAbortAction(true);

I don't know how to get this information from import set/transform map for end user. Is there a way to achieve this in record producer script?

Please advise.