I want to get the row count on Inserted,Created,Updated,total records in transform map.

Shweta Kasbe1
Tera Contributor

I want to get the row count on Inserted,Created,Updated,total records in transform map.find_real_file.png

I have written a script it is not giving me accurate count.Please below ss. Please guide me in this.

var griii4 = new GlideRecord('sys_import_set_run');
griii4.addEncodedQuery('sys_transform_map=04dddc901b04d1502be3dbd1f54bcba4^stateINrunning,complete,complete_with_errors,cancelled,incomplete,cancel_requested^updates=7,223');
griii4.query();
gs.print(griii4.getRowCount());
template.print("<tr><td style='border: 1px solid black;text-align: center; padding: 6px;'>Approvers</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getRowCount()+"</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getRowCount()+"</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getRowCount()+"</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getRowCount()+"</td></tr>");

find_real_file.png

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

instead of getRowCOunt() being passed in all cells, you should be passing

griii4.getValue("total")/griii4.getValue("updates")/griii4.getValue("inserts")/griii4.getValue("ignored")/griii4.getValue("skipped")// check the backend field names

 

var griii4 = new GlideRecord('sys_import_set_run');
griii4.addEncodedQuery('sys_transform_map=04dddc901b04d1502be3dbd1f54bcba4^stateINrunning,complete,complete_with_errors,cancelled,incomplete,cancel_requested^updates=7,223');
griii4.query();
gs.print(griii4.getRowCount());
template.print("<tr><td style='border: 1px solid black;text-align: center; padding: 6px;'>Approvers</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getValue("total")+"</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getValue("insert")+"</td><td style='border: 1px solid black;text-align: center;padding: 5px;'>"+griii4.getValue("ignored")+"</td></tr>");

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

View solution in original post

6 REPLIES 6

Hey @Shweta Kasbe 

Didn't hear back on this.

Is your issue resolved? If yes, feel free to mark helpful/correct, so it will be helpful for others looking for similar query.

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Point mentioned by Aman will work.

Please ensure you use correct field names

Regards
Ankur

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