How to create a notification for contract before 30 days start of 2nd 3rd and 4th quarter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 04:58 AM
I want to create a notification for contract payment reminder before 30 days start of 2nd 3rd and 4th quarter
as contract have quartile payment option
so notification need to trigger before 30 days start of Q2, Q3...
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 06:21 AM
Hi @Anuj30
To create notifications for contract payment reminders before 30 days at the start of the 2nd, 3rd, and 4th quarters, you can leverage Scheduled Jobs. Below is a general outline of how you might achieve this using a Scheduled Job:
// Get the current date and time
var now = new GlideDateTime();
// Calculate the start of the next quarter
var startOfNextQuarter = new GlideDateTime();
startOfNextQuarter.setMonthUTC(now.getMonthUTC() + 3);
startOfNextQuarter.setDayUTC(1);
startOfNextQuarter.setHourUTC(0);
startOfNextQuarter.setMinuteUTC(0);
startOfNextQuarter.setSecondUTC(0);
// Query for contracts with payments due in the next quarter
var contractGr = new GlideRecord('your_contract_table');
contractGr.addQuery('payment_due_date', '>=', startOfNextQuarter);
contractGr.addQuery('payment_due_date', '<', startOfNextQuarter.addDays(-30));
contractGr.query();
while (contractGr.next()) {
// Trigger notification logic here
gs.eventQueue('contract.payment.reminder', contractGr, 'your_notification_script_include');
}
please mark as accepted solution & hit helpful if it suffice your requirement
BR, Sohith
Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)