Flow Sending Reminder Emails Every Day After the 15th Day Instead of Only on 15th and 22nd Day

Rahuf Sayyad
Tera Contributor

Hello,

I’ve created a flow in ServiceNow to send reminder emails on the 15th and 22nd day if the request is still in the "waiting for approval" state based on the RITM table. However, while the flow is correctly sending the email on the 15th day, it is also sending emails every day after the 15th, which is not the intended behavior.

Flow Setup:

  • The flow is supposed to trigger only on the 15th and 22nd day after the request is created.

  • I have conditions in place to check if the request is still in the "waiting for approval" state.

  • The reminder email is being sent on the 15th day, but after that, it continues to send the reminder every day, rather than just on the 22nd day.

Additionally, if the request is not approved, the record should be automatically closed on the 30th day after creation, and this condition is working as expected.

 

Problem:

The flow continues to send reminder emails every day after the 15th day, which shouldn't happen. The email should only be sent on the 15th and 22nd day.

 

Request:

Can anyone help me identify why the flow is sending emails every day after the 15th? Any suggestions for modifying the flow logic to ensure it only sends the email on the 15th and 22nd day would be greatly appreciated!

 

Note: The flow is already in production, and the issue needs to be fixed as soon as possible to ensure only the 15th and 22nd-day reminders are sent.

 

Thank you!

 

RahufSayyad_0-1745770901861.pngRahufSayyad_1-1745770945119.pngRahufSayyad_2-1745770974819.pngRahufSayyad_3-1745770987918.png

 

1 ACCEPTED SOLUTION

@Rahuf Sayyad 

I updated my post above and sharing it again

This should give exact 15 days

AnkurBawiskar_0-1745851577223.png

 

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

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

View solution in original post

13 REPLIES 13

Rahuf Sayyad
Tera Contributor

The 'Created' condition is not working correctly. Could you please suggest a solution?

lpruit2
Kilo Sage

Greetings Rahuf,

 

Good catch that the "Created" condition. Because it says "relative before 15 days ago" it is not looking for Created IS 15 days ago, it is looking for Created >= 15 days ago. This means it will return results that are 16 days, 17 days, 18 days, etc. On my PDI, I changed "relative" to "on" but unfortunately, I did NOT see the option to pick 15 days exactly. What you may want to do is use an in-line script and call the GlideDateTime API. You can use the .addDays method and use a negative number to subtract the days. 

lpruit2_0-1745806935962.png

Here is a screenshot from the ServiceNow Developer website. 

lpruit2_1-1745807015546.png

 

Hi,

 

It would be helpful if you could tell me what script will contain and where to use it.

Hi @lpruit2 ,
 
I tried below script in the flow but it is fetching all records and not just the records which are created 15 days ago.
 
 
// Create GlideDateTime objects for 15 and 22 days ago
var today = new GlideDateTime();
var fifteenDaysAgo = new GlideDateTime();

// Subtract 15 and 22 days from today
fifteenDaysAgo.addDays(-15); // 15 days ago
 
// Define the conditions for the lookup (RITM table)
var gr = new GlideRecord('sc_req_item'); // RITM table (Request Item)
gr.addEncodedQuery(
  'stage=waiting_for_approval^stateIN-5,1^approvalNOT INapproved,rejected' +
  'sys_created_on' + fifteenDaysAgo.getValue()
);

// Execute the lookup and check if there are any matching records
gr.query();