- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 12:49 AM
My requirement is to send final reminder to users before one day of due date(which keeps on changing).
Hence I have written scheduled job to trigger the event in notification.
But I have tried 2 methods to find that due date is 1 day away from today .
In both the methods I am not getting the expected results.
Kindly check and please help me here.
Note: I am writing this scheduled job in scopped application ,that's why some functions are different.
Method 1:
var gr = new GlideRecord('sn_vdr_risk_asmt_assessment');
gr.addEncodedQuery("number=VRA0005492^active=true^state=2");
gr.query();
while(gr.next())
{
var gdt = new GlideDateTime();
gs.print(gdt);
gdt.addDaysLocalTime(1);
var vraDD = gr.questionnaire_due_date;
var gdt1= new GlideDateTime(vraDD);
gs.print(gdt1);
var duration= GlideDateTime.subtract(gdt1,gdt);
gs.print(duration);
var dd = duration.getDayPart();
gs.print(dd);
if(dd==0)
{
gs.print(gr.number);
gs.print(dd);
}
}
2.
Here I am directly querying due date.
Ideally this should shows VRA having due date on 19th Jan i.e. tomorrow.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 02:20 AM
Hi,
if you use schedule job you need to script that, create event and link it with email notification
Using flow skips all this and makes your task easier to maintain
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
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
‎01-18-2022 02:15 AM
Thanks Ankur
We can use same query in Schedule job as well.
But is there any other advantage of using flow designer other than no scripting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 02:20 AM
Hi,
if you use schedule job you need to script that, create event and link it with email notification
Using flow skips all this and makes your task easier to maintain
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader