Export set condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2017 10:58 AM
I'm trying out the export set feature with the scheduled export option. I've noticed that it will continually export data whether or not there's new or changed data. This leaves me with a whole bunch of empty CSV files.
This is my conditional script to list any records created after the "last run" field from the scheduled export but I'm not sure if I can reference the last run field properly.
var gr = new GlideRecord('u_export_table');
gr.addEncodedQuery('sys_created_on>=javascript:gs.dateGenerate'+ '(' + current.last_export_run + ')');
gr.query();
if(gr.getRowCount() < 0){
cancel = true;
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2017 11:06 AM
Hi Kim,
Please try this code
var gr = new GlideRecord('u_export_table');
gr.addEncodedQuery("sys_created_on>=javascript:gs.dateGenerate('"+current.last_export_run +"')");
gr.query();
if(gr.getRowCount() < 0){
cancel = true;
}
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2017 01:01 PM
I don't think that's quite right. I also realized the cancel = true option isn't available in the condition field. I think it'd be just a true or false option, which I've tried already.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2020 02:28 PM
This worked for me.
Write this inside conditions box,
var gr = new GlideRecord('u_lenovo_laptop_bundle');
gr.addEncodedQuery("sys_created_on>=javascript:gs.dateGenerate('"+current.last_export_run.getDisplayValue()+"')");
gr.query();
gs.log('Found ' + gr.getRowCount() + ' records');
if(gr.getRowCount() < 1){
answer = false; // Do not export
}
else{
answer = true; // Do the export
}
Thanks,
Rajini