Scheduled job email reminder 30/60/90

Richard Thomas2
Tera Contributor

Hi Experts,

I need to send a email reminder and create comments on a record if the user hasnt updated it after 30 days and 60 days.

How can create a comment on the record with out updating the record - I've tried gr.autoSysFields(false); but this fires the notification and does not update the record (see code below)

var gr = new GlideRecord('sn_hr_core_case');
gr.addEncodedQuery('sys_updated_onRELATIVELT@dayofweek@ago@30');
gr.addQuery('assignment_group' ,'IN',gs.getProperty('sn_hr_core.hr.assignmemt.group'));
gr.query();

while (gr.next()) {
    gr.comments = 'You have not provided an update on your case within the last 30 days. It is really important that you provide an update within the next 60 days or the case will be closed. 
    gr.autoSysFields(false);
    gr.update();

Can anyone advise?

Thanks

Richard

6 REPLIES 6

Akash Rajprohit
Mega Contributor
Hi, alternative here -> create record into sys_journal_field using GlideRecord while iterating var gr = new GlideRecord('sn_hr_core_case'); gr.addEncodedQuery('sys_updated_onRELATIVELT@dayofweek@ago@30'); gr.addQuery('assignment_group' ,'IN',gs.getProperty('sn_hr_core.hr.assignmemt.group')); gr.query(); while (gr.next()) { var rec = new GlideRecord('sys_journal_field'); rec.initialize(); rec.name = 'sn_hr_core_case'; rec.element_id = gr.getUniqueValue(); rec.element = 'comments'; rec.value = 'You have not provided an update on your case within the last 30 days. It is really important that you provide an update within the next 60 days or the case will be closed'; rec.insert(); }

Hi Akash.

Why did you reply an exact copy of Ankurs reply?