- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2020 05:01 AM
Hello Everyone,
I have request to send the Reminder Email for the Survey. The Survey Active period is 5 days( say for ex: if the survey is
generated on 12/08 the due date will be on 12/13)
The Reminder email should trigger on 12/11, which is two days before due date. I have tried the below query
due_dateRELATIVEGT@dayofweek@ahead@3^state=ready in the Assessment Instance table.
But it is pulling all the records which is relative after 3 days. I just need the exact record count not all the records which is after 3 days? Say if 10 record has the due date on 12/13, i just need only the 10 records.
Can anyone help me out of this?
Regards,
Prem
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 02:59 AM
Hi,
Can you try this filter
It worked well for me
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 02:33 AM
Hi Ankur,
No I don't find any record in the table. But still i have due date records for 12/13.
Do we have any other way to get the required data, using scripting. If so can you please suggest me the same.
I have tried the below script as well, but it is not working!
var survey = new GlideRecord('asmt_assessment_instance');
survey.addEncodedQuery('metric_type=b8a55869db6557481048715a8c9619da^userISNOTEMPTY^state=ready^due_dateRELATIVEGT@dayofweek@ahead@1');
//survey.setLimit(1); //limiting the query to just one record
survey.query();
while(survey.next()) {
var ps = new GlideDateTime(survey.due_date.getDisplayValue());
ps.addDays(-2);
var dateafter = ps.getDate();
gs.print(dateafter);
if(dateafter == gs.nowDate())
{
gs.eventQueue('survey.reminder', survey);
}
}
Regards,
Sankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 02:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 03:07 AM
Hi Ankur,
Thanks for the Suggestion!
Could you please explain the second filter condition, it is still confusing for me?
Sample Date Relative before 3 days from now ?
Regards,
Prem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 03:16 AM
Since you require exact 2 days.
1) After 1 day and Before 3 days - gives exact 2 days
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 03:59 AM
Did you mistakenly mark your own response as correct?
Would you mind marking my response as correct if I was able to help you
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader