Send An Email Reminder Based On a Variable Date Field

GamNOW
Tera Contributor

Hello ServiceNow Community,

 

I am looking to achieve a requirement that simply sends an email notification 60 days before the due date. based on:

 

Variable type: Date

Tech name: due_date

 

Requirement: Send a email notification if today's date reaches 60 days or less before the due date. 

 

What's an efficient way to develop this? I figured a scheduled job would suit my case. But how would you query the variable and its value? So that if these conditions meet, send out an notification that contains a link to the RITM.

 

Thank you! 

 

 

2 REPLIES 2

Matthew_13
Mega Sage

Yes my friend — a scheduled job is the right way to do this, especially since your “due date” is a catalog variable.

What I’d do:

  1. Add a real date field on the RITM (example: u_due_date) and a simple flag like u_60_day_notice_sent.

  2. Copy the variable value into that field when the RITM is created (or when the variable changes). This avoids having to query the variable tables every day.

  3. Create a Scheduled Script Execution that runs daily and finds RITMs where:

    • u_due_date is within the next 60 days, and

    • u_60_day_notice_sent is false

  4. For each match, trigger an event or send directly and include a link to the RITM in the email.

  5. Set the flag to true so the user doesn’t get the same email again tomorrow.

That approach is much simpler than querying sc_item_option_mtom for the variable value on every run, and it scales better.

 

@GamNOW  - Please mark Accepted Solution and Thumbs Up if you found Helpful 🙂

Stefan Reichelt
Kilo Sage

You can also get it done within a Flow for each record (depending on the volume of records). Add the Flow logic "Wait for a duration of time", and then either "Send Email" or "Send Notification".