Scheduled job for survey

Fotina
Tera Contributor

Hello All,

 

I got an issue with where to start, maybe you will have some idea?

I need to send a reminder only after 3 days when Incident was resolved and only once. 

It is important only 1 reminder and after that no other notifications are expected.

I already have notification created "Satisfaction Survey". Event registry as well. Now it is time for scheduled job where I am stuck, would you have any idea how to set up this Scheduled job or maybe there is another option to make this after 3 days sending?

 

Thank you in advance Guys!

 

Best regards,

Tina

2 REPLIES 2

Basheer
Mega Sage

Hi @Fotina ,

When you resolve an incident, the OOB field resolved_at would be populated.

Based on that date and today's date you can trigger the notification.

var resolvedAt= current.resolved_at;
var date = new GlideDateTime();
var today= new GlideDateTime();
var resolvedDate = date.setDisplayValueInternal(resolvedAt);

 
var diffSeconds = gs.dateDiff(today.getDisplayValue(), resolvedDate.getDisplayValue(), true);
var days = diffSeconds/(60*60*24)
 
if(days == 3){
//code here
}
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Fotina
Tera Contributor

Hello Basheer,

 

Thank you so much, i created as you said and triggered event however it didnt work, do you have any idea what i missed?

var resolvedAt= current.resolved_at;
var date = new GlideDateTime();
var today= new GlideDateTime();
var resolvedDate = date.setDisplayValueInternal(resolvedAt);


var diffSeconds = gs.dateDiff(today.getDisplayValue(), resolvedDate.getDisplayValue(), true);
var days = diffSeconds/(60*60*24);

if(days == 3)
{
gs.eventQueue('survey.send.reminder.notification', current, gs.getUserID(), gs.getUserName());
}

 

Thank you,

Fotina