- 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-27-2018 07:18 AM
To avoid coding you could download the scriptless scheduled jobs app from the link below:
https://community.servicenow.com/community?id=community_blog&sys_id=ae9caee1dbd0dbc01dcaf3231f96193d
ALternatively, you could configure an SLA to track the Next Email field, the SLA app already has a series of scheduled jobs that track fields and change the state of the SLA accordingly, you could use the state change of the SLA to trigger your notification.
Or, if you're on Kingston, you could try out the flow designer or try using a function field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 09:15 AM
I'm unable to download the file.
It's asking for a HI account and i don't have one.
Kindly help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 12:50 AM
Are you not able to register for an account?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 03:17 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 02:05 AM
Hello Mark
Look at this
I did created a sample table and add a field called "next_email".
I did register an event called "next_email"
I did created a scheduled job with this code:
// Get dateNowDT
var dateNowDT = new GlideDateTime();
gs.log('dateNowDT = ' + dateNowDT);
//Loop the incident table with the next_email field
//This is an example
var gr = new GlideRecord("u_glo_test"); //replace with incident table
gr.addEncodedQuery('u_next_emailISNOTEMPTY'); //replace with the filter criteria you want
gr.query();
while (gr.next()) {
var nextEmail = gr.getValue('u_next_email');
var nextEmailDT = new GlideDateTime(nextEmail);
gs.log('nextEmail = ' + nextEmail);
gs.log('nextEmailDT = ' + nextEmailDT);
var result = dateNowDT.compareTo(nextEmailDT);
gs.log('result = ' + result);
if (result == 0) { //equals
gs.eventQueue('next_email',current,'parm1','parm2');
}
}
When the next_email date in the table is equals to nextEmailDT obatin in the scheduled job then an event in the queue is generated.
Look at this to the GlideDateTime comparisson examples
https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideDateTime/concept/c_GlideDateTimeAPI.html
Next steps
You must create a notification when the event is fired
I think you must "mark" the record of the incident table with something similar to "processed" or enhancement the query filter to prevent process the same rows twice or more.
I hope my answer has been useful
Ariel
PS: Please mark my answer correct or helpful if I have helped you. Thanks