Transform script for Throwing error if there is error while importing records

MaharshiC
Tera Contributor

Hi,

 

I have a staging table ,transform map and target table. Now I am reading the excel and with a br I am creating records in the staging table and with the transform map I am creating records in the target table. Now I want to show the user an alert whatever is the status of the transformation like if it is completed/completed with errors. So I have written an oncomplete transform script but here the status is showing as running instead of the actual status. What changes do i need to do in the script or do I need to change the approach of the alert?

var transformrec = new GlideRecord('sys_import_set_run');
transformrec.addQuery('set', source.sys_import_set);
transformrec.query();
if (transformrec.next()) {
	gs.info('state'+transformrec.state);
    gs.info('test22' + transformrec.sys_id);
	gs.info('req'+source.request_number);
   
}

MaharshiC_0-1734341955768.png

MaharshiC_1-1734341981869.png

Ideally the status should show completed with errors but it is showing as running.

12 REPLIES 12

@MaharshiC 

Hope you are doing good.

Did my reply answer your question?

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

@MaharshiC 

Hope you are doing good.

Did my reply answer your question?

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

@MaharshiC 

Hope you are doing good.

Did my reply answer your question?

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