Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to send reminder after 14 days if task is open

Dasari Srihari
Tera Contributor

Hi All,

 

I need to send notification for opened Catalog Tasks after 14days only one time. I have created variable called reminder(Checkbox variable) after 14days we need set this value true same time we need to send notification,

 

i need to send notification to assignment group, 

 

Please find my script below:

 

var task = new GlideRecord("sc_task");
task.addEncodedQuery('request_item.cat_item=36db14d8db7043005eb551b0cf96196a^stateIN-5,1,2');
task.query();

while (task.next())
{
var text = task.request_item.variables.reminder;

if(text == ' '){

task.text = true;
task.update();
//gs.eventQueue('Test');
}


}


 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Dasari Srihari 

why not use Flow designer for this with no script?

1) Flow triggers every day and checks which sc_task is opened from last 14 days

2) for each of that sc_task send email and update the variable

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron

@Dasari Srihari 

why not use Flow designer for this with no script?

1) Flow triggers every day and checks which sc_task is opened from last 14 days

2) for each of that sc_task send email and update the variable

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Dasari Srihari 

is this only for specific catalog task which belongs to particular catalog item?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

Thanks for your response, I need to send reminder after 14days only one reminder, only for one catalog item

@Dasari Srihari 

then you can use a custom field on sc_task which will update as true to identify reminder is sent for this record

Then update the filter condition as well in flow while Looking up records

Example I shared below: Enhance it to use your boolean field instead of active which I shared in filter condition in flow

Flow catalog task.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

I will follow this process, whenever we are sending reminder how to update filed in task table,

 

I have created reminder count field if 0

value 0 after 14days flow will trigger reminder

Whenever reminder triggering i need to update Reminder field value to 1

DasariSrihari_0-1666288412503.png