- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 08:27 AM
All,
I have a field on the incident form
Name : 'Next Email'
Type - Date/Time
An E-mail should be sent as per the date and time selected in that field.
Is this possible.? If yes, Kindly help
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 08:52 PM
Mark,
eventQueueScheduled works to trigger an email on a particular date and time. Only when Next email is updated from empty to a new value, it triggers an event to be processed at the specified date and time.
I am not sure what is not working for you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 09:43 AM
And, in the notification, you have to make the changes as below:
Fill the highlighted area with your event name.
--------------------------------------------------------------------
-----------------------------------------------------------------------------------
Mark the answer as Correct/Helpful based on its impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 12:54 PM
Hi,
I tried with the above code, it's not working.
E-mail are not triggered.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 02:10 PM
Mark,
This would work for this requirement.
var gr = new GlideRecord('incident');
gr.addQuery('u_next_email',new GlideDateTime());
gr.query();
while(gr.next())
{
gs.eventQueue('event_name',gr,gr.caller_id);
}
I have tested it and it is working. But this scheduled job needs to be run very frequently. Otherwise, the query cannot fetch the appropriate records since Next Email is a Date/Time field. So, Scheduled Job should run periodically(every second).
Mark the answer as Correct/Helpful based on its impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 03:06 AM
It's not working for me..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 01:28 PM
Hello Mark,
Try a workflow which contains a timer and notification.
Make start condition as "next mail" field not empty.
Inside the timer write the script by selecting the script option.
answer = gs.dateDiff(gs.nowDateTime(),current.u_next_mail.getDisplayValue(),true);
now you can build notification however you like.
Regards
Sree