How to cancel an import
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 05:34 AM
I'm running a pre import script and testing a condition at the end to determine whether or not to proceed with the import. The wiki is telling me to use
cancel = true;
as a means to stop the import. However, the import is still occurring. Am i missing something? The variable answer is logging correctly (true when between 8am and 5pm, false otherwise)
//Determine if the job should be run
var answer = false;
//Get the day of week. 1=Monday, 7=Sunday
var now = new GlideDateTime();
now.addSeconds(now.getTZOffset() / 1000);
var dow = now.getDayOfWeekLocalTime();
//Run only on weekdays
if(dow < 6 ){
var dayStart = new GlideDateTime(now.getDate() + " 08:00:00");
var dayEnd = new GlideDateTime(now.getDate() + " 17:00:00");
//Running this job at 10, only during business hours and scheduling every 3 hours will only cause the job to run at 10am, 1pm and 4 pm
if (now.compareTo(dayStart) == 1 && now.compareTo(dayEnd) == -1) {
answer = true;
}
}
gs.log("Answer = " + answer + ". Day start: " + dayStart + " - Now: " + now + " - " + "dayEnd: " + dayEnd,"jc");
//if answer is still false, cancel the import... it is not the time of day that we want to import
if (!answer) {
gs.log("Cancelling this import","jc");
cancel = true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 05:38 AM
ignore = true;
Can you try once by giving ignore true .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 06:29 AM
Harish, this in a pre import script on a scheduled import. it's not an onStart script.
Nevertheless, i was curious so i tried it. I modified the dayEnd to 9am and tried running it at 9:25am using "ignore = true;"
Unfortunately, it did not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 06:32 AM
ok . Lets see either some one having solution to this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 06:35 AM
Nevermind, while the import set was showing in the list of import sets, it actually wasnt doing the import. it truly was being cancelled by the script. i feel silly.