- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 01:38 PM
Hi,
I want an email to be sent when a specific date field has reached 30 days before the actual date.
I have set this on the contracts table but is it not working, does anyone know a script I can use?
The field is a date field called u_review_date
When this is less than 30 days away and email notification should be triggered.
Any ideas?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 06:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 01:55 PM
The scheduled job would look something like this.
Standard disclaimer: The following code is untested, requires review and potential modifications.
(function () {
// Get a list of records that are coming due
var rec = new GlideRecord('u_contract'); // Use the right table, I made this one up
rec.addQuery('u_review_date', '<=', gs.daysAgo(-30)); // Get records updated -30 days ago (in the future)
rec.addNullQuery('u_reminder_date'); // and not already reminded
rec.query();
while (rec.next()) {
gs.eventQueue('contract.reminder', rec, '', '');
rec.u_reminder_date = new GlideDateTime();
rec.update();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 01:59 PM
better formatting, more eloquent, and a disclaimer to boot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 02:06 PM
Thank you - I will try the above tomorrow ad update this thread
Riaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 04:47 AM
Hi,
I have decided to do this via a workflow as I want a ticket created as well and an Incident.
In the Begin I have a Filter condition of State is Active
What should the next box contain, a Timer or a Wait for condition?
I only want the workflow to Trigger if the Date Field Review Date is 30 days away.
I cant seem to find how to start this trigger.
Thanks,
Riaz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 06:12 AM