Skip to content

Commit 74e184a

Browse files
Create script.js
1 parent c264f76 commit 74e184a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

  • Server-Side Components/Transform Map Scripts/Check if the Import file is valid
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
When : onStart
3+
Active : True
4+
*/
5+
6+
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
7+
8+
var table = import_set.table_name;
9+
var run = new GlideAggregate(table);
10+
run.addQuery("sys_import_set", import_set.sys_id);
11+
run.addAggregate('COUNT');
12+
run.query();
13+
while (run.next()) {
14+
var count = parseInt(run.getAggregate('COUNT'));
15+
if (count < 1) { // Check the row count of the latest import job. If it's 0, then abort the transformation and raise a ticket (Optional)
16+
ignore = true;
17+
gs.error("File is empty. Hence aborting the transformation");
18+
}
19+
}
20+
21+
})(source, map, log, target);

0 commit comments

Comments
 (0)