Skip to content

Instantly share code, notes, and snippets.

@manvillej
Created July 23, 2019 15:16
Show Gist options
  • Save manvillej/0da9f37ae40a4118f0ef890ae8cf2e5b to your computer and use it in GitHub Desktop.
Save manvillej/0da9f37ae40a4118f0ef890ae8cf2e5b to your computer and use it in GitHub Desktop.
modified Set Start and End Dates
(function executeRule(current, previous /*null when async*/) {
if (current.end_date < current.start_date) {
gs.addErrorMessage('End date must be later than start date!');
current.setAbortAction(true);
}
var today = new GlideDateTime((new GlideDate().getValue()) + " 23:59:59");
if(today.after(new GlideDateTime(current.start_date))) {
gs.addErrorMessage('Start date must be after today');
current.setAbortAction(true);
}
})(current, previous);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment