Need help on date calculations

Kenny_vl
Tera Contributor

I have a requirement to trigger a notification on a contract's end date minus the notice period minus 30 days.
I am free to implement this however, so I figured to create a flow for this which runs on a daily schedule.
However, I am having difficulties to calculate the date.
This calculation needs to be 30 days before a contract's notice period.
The contract has the field ast_contract.ends set and a custom field (type duration) ast_contract.u_notice_period (for example 90 days), in this scenario the notification would trigger 120 days before the contract's end date.

 

I created a flow which runs on a daily schedule, I used a Lookup records flow action to retrieve all active contracts, followed by a for each action to loop through the records.

This is where I'm stuck. I can't figure out how to calculate if today is the date where the notification should be triggered. So I am looking for help in scripting ast_contract.ends-ast_contract-u_notice_period-30 days

 

Any input/advice/suggestions would be appreciated. I've looked at the GlideDateTime API's and the Durationcalculator script include but I just don't understand the concept with the duration field.

7 REPLIES 7

@Kenny_vl 

Hope you are doing good.

Did my reply answer your question?

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

Kenny_vl
Tera Contributor

I ended up deleting the column and recreating it as an integer. This allowed me to perform the calculations I needed

@Kenny_vl 

Glad to know.

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