Reminder table? How does this work?

Tom Alday
Mega Guru

I'm trying to use the reminder table as a way to auto-generate reminders for task records. I have a business rule on the task table (Problem) set to generate a reminder task whenever the Due Date field changes and is not empty, but it's not creating the reminder task when I update these records.

var rem = new GlideRecord('reminder');

rem.initialize();

rem.task = current.number;

rem.user = current.assigned_to;

rem.subject = current.short_description;

rem.notes = current.description;

rem.insert();

This is a pretty normal BR and I've done it in the past to generate records on other tables, but it refuses to work for this Reminder table - which by the way I can't find any documentation on in the wiki, I just kind of stumbled onto it while looking at available related lists.

3 REPLIES 3

Michael Kaufman
Giga Guru

You also need to set these fields in your GlideRecord insert:



  • remind_me  
  • using   //this might be not set
  • field


Also this lines is incorrect



rem.task = current.number;



to



rem.task = current.sys_id;



this might also work



rem.task = current;


Once you set the all the fields, it should create a scheduled job for the reminder.


Tom,


Were you able to get this to work/ find any documentation around this related list?   I have added the related list but the job does not get scheduled.   Do you have to have the on-call plug-in active?


Mariano Lemus
Kilo Guru

The following is an easy way to set it up in a BR:

 

current.due_date = (current.estimated_delivery.nil()) ? current.due_date : current.estimated_delivery;
var estDate = current.due_date.toString().substr(0,10);

var gr = new GlideRecord('reminder');
gr.initialize();
gr.field='due_date';
gr.subject='Delivery date of '+current.number+' is on '+estDate;
gr.notes='The due date for '+current.number+' is on '+estDate+'\n\nIf needed, please update the date.';
gr.remind_me='1440';
gr.task=current.sys_id;
gr.user=current.assigned_to;
gr.using='email';
gr.insert();

 

Be mindful of how many reminder records you attach to a TASK.

 

Upon triggering the event: reminder.notify.email it will process all reminder records. 

 

It will send as many emails as reminder records, regardless of the remind_me value.

 

Mariano