how to send notification at a particular date and time in servicenow

damarlaravi
Kilo Contributor

we have one field next review date, my requirement is send a notification 1 day prior to that next review date.

I wrote the following code to send notification but notification is triggering on current date and time only

function onAfter(current, previous) {

    //This function will be automatically called when this rule is processed.

    var date1 = new GlideDateTime();

  var review_date=current.u_next_review_date;

      date1.setDisplayValueInternal(review_date);

  date1.addDays(-1);

gs.eventQueueScheduled("incident.reminder", current, gs.getUserID(), gs.getUserName(), date1.getDisplayValue());

}

Guys can u please help on this, any suggestion is helpful

6 REPLIES 6

try this and see how it goes



var opened_at=new GlideDateTime(current.opened_at);


opened_at.addDays(-1);


gs.eventQueueScheduled("open_incident_oneday", current, gs.getUserID(), gs.getUserName(), opened_at);


Hi Pradeep,

 

 

here i have one typical task that is send notification when Due date and time reached

Ex: in incident table i have 5 incidents

first ---> due date 26-04-2018 16:00:00      send notification exact at      26-04-2018 16:00:00

second--->due date 26-04-2018 13:20:00   send notification exact at   26-04-2018 13:20:00 

third--->due date 26-04-2018 18:00:00

fourth--->due date 26-04-2018 17:40:00

fifth--->due date 26-04-2018 16:10:00      all incidents are 26-04-2018 but time is different so is it possible to send notification based on Date & time   when it match with   current Date & Time......   

 

find_real_file.png

 

please suggest me i am getting confusion here...why means

Example: i have 5 incidents on 26-04-2018 with different timing... so may be if i does n't insert/update any incident records  for 3 days then on 25th, 26th, 27th days of notifications how can we trigger notification...... as per Exact time...