Send a reminder email before End date is due

WaledBajukhaif
Tera Expert

We have a request to create a field "xyz" to enter number of days in [ast_contract] table, this field will count how many days left to "End Date" field. then send a notification/reminder to "Manager" field.

 

Ex: a contract end date is "31/12/2028", i want to send a notification/reminder to the manager 6 months (or X months) before 31/12/2028. which means i would enter "182" (this is number of days ~6 months) in "xyz" field.

When current date is "01/07/2028" send a notification. (because it's 182 days left to End date).

 

Any help/suggestion would be helpful

Regards

 

 

14 REPLIES 14

Hi @WaledBajukhaif 

So what I mean is, how do you differentiate between Contract A and Contract B? Based on your example, if you want to send a reminder for Contract A six months in advance, but for Contract B only three months, the system needs some form of identifier that we can configure in the workflow. That way, reminders can be set accordingly. At a high level, tomorrow the requirement might be to send a reminder for Contract Z just seven days before — so the solution should be flexible enough to handle such cases.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

@WaledBajukhaif 

what's the actual customer requirement?
there are 2 options for that custom field

1) date ->

a) it will be easier in flow or scheduled job to check if today is that date, if yes then send reminder email.

b) you will need a date validation so that agent doesn't enter a date beyond the contract end date.

OR

2) integer -> it will be somewhat complex but you can go with this logic

1) iterate over all the contracts

2) get contract end date and substract the days present in the custom field -> you will get a date

3) then compare today's date with that date from Step 2

4) if same then send email using gs.eventQueue()

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

I will work on option 1 "Date" field, it's easier to achieve and add restriction not to enter a date beyond end date..

and will check the result afterwards..

Thanks

@WaledBajukhaif 

Glad to help.

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

Hi @Ankur Bawiskar 
the first option worked but the company wants to use integer field to enter a number rather than a date.. can you walk me through the steps OR write a script to help me achieve this?

Thanks