Approval Reminder email every 3 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2020 02:26 PM
Hi All,
Could you please let me know how to send reminder email to the approvers to whom knowledge articles are sent for approval.
I have created the below Scheduled job to trigger email every 3 days for 4 times to the approvers which are in Requested state .
I am not able to trigger email notification using this , please guide me where am I doing wrong.
var grKB = new GlideRecord('sysapproval_approver');
grKB.addEncodedQuery('state=requested^source_table=kb_knowledge');
grKB.query();
while(grKB.next()){
if((grKB.document_id.kb_knowledge_base.sys_id == 'e81c9a0ddbc15810c38f0763b99619c1') || (grKB.document_id.kb_knowledge_base.sys_id == '21302e89db055810c38f0763b99619cc')) {
var duplciatednumebrs = '';
duplciatednumebrs += grKB.document_id.number+',';
gs.info("the HR approvals are :" +duplciatednumebrs);
var created = grKB.sys_created_on.getDisplayValue();
gs.info("the created data of approval is :" + created);
var timeToAdd3 = 259200; // 3 days
var timeToAdd6 = 518400; // 6 days
var timeToAdd9 = 777600; // 9 days
var timeToAdd12 = 1036800; //12 days
//gs.log('neha1',created);
var sched;
var schedRec = new GlideRecord('cmn_schedule');
schedRec.get('name', '24 x 7');
if (typeof GlideSchedule != 'undefined')
sched = new GlideSchedule(schedRec.sys_id);
else
{
sched = new Packages.com.glide.schedules.Schedule(schedRec.sys_id);
}
var UpdatedDateTime = new GlideDateTime(created+' 00:00:00');
gs.info('The HRKB updated RG:' + UpdatedDateTime);
var durToAdd3 = new GlideDuration(timeToAdd3*1000);
var durToAdd6 = new GlideDuration(timeToAdd6*1000);
var durToAdd9 = new GlideDuration(timeToAdd9*1000);
var durToAdd12 = new GlideDuration(timeToAdd12*1000);
var newDateTime3 = sched.add(UpdatedDateTime,durToAdd3);
var newDateTime6 = sched.add(UpdatedDateTime,durToAdd6);
var newDateTime9 = sched.add(UpdatedDateTime,durToAdd9);
var newDateTime12 = sched.add(UpdatedDateTime,durToAdd12);
var TodaysDate = new GlideDate();
if(newDateTime3.getDate().toString() == TodaysDate.toString())
{
gs.eventQueue('HRKBApprovalReminder',grKB, '', '');
}
else if(newDateTime6.getDate().toString() == TodaysDate.toString())
{
gs.eventQueue('HRKBApprovalReminder',grKB, '', '');
}
else if(newDateTime9.getDate().toString() == TodaysDate.toString())
{
gs.eventQueue('HRKBApprovalReminder',grKB, '', '');
}
else if(newDateTime12.getDate().toString() == TodaysDate.toString())
{
gs.eventQueue('HRKBApprovalReminder',grKB, '', '');
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2020 02:31 PM
use below solution
Regards,
sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2020 02:39 PM
Hi Sachin,
I have checked this but was not sure what to do there, could you please guide what is wrong in the Script I pasted.