When ever any agreement of the Customer or Client reaches 90 days to expiration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 04:38 AM
Hi Team,
In 90 days an agreement was expired, and how to send automatic email notifications to the users (before expiration).
Regards,
Mahesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 04:57 AM
Hi @maheshch18 ,
You can write a scheduled job and run it on daily basis. You will need to check the expiration date of these agreements and trigger notification using gs.eventQueue() method.
Thanks,
Kanhaiya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 05:55 AM
Hi Kanhaiya,
I have tried the below code in the scheduled job.
var currentDate = new GlideDate();
currentDate.addDaysUTC(90);
var ed=currentDate.getDate();
var gr = new GlideRecord('sn_customerservice_agreement');
gr.addQuery('u_end_date',ed);
gr.query();
while(gr.next()){
gs.eventQueue('sn_customerservice.Agreement Expiration',gr,'','');
gr.update();
}
But It's not working fine.
Regards,
Mahesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 01:21 AM
Hi @maheshch18,
You cad do as per below example -
FirstJob(); // To fetch agreements which will be expired after 30 days
SecondJob(); //to fetch agreements which will be expired after 60 days
function FirstJob()
{
var gr = new GlideRecord('table_name');
gr.addEncodedQuery('expiration_dateRELATIVEEE@dayofweek@ahead@30');
gr.query();
while(gr.next()){
gs.eventQueue("expire.reminder",gr,30);
}
}
function SecondJob()
{
var gr = new GlideRecord('table_name');
gr.addEncodedQuery('expiration_dateRELATIVEEE@dayofweek@ahead@60');
gr.query();
while (gr.next()){
gs.eventQueue("expire.reminder",gr,60);
}
You may modify the days in condition.
Hope it helps, Please mark may solution as correct if you find it helpful.
Thanks,
kanhaiya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 09:59 AM
Hi Kanhaiya,
I need to update the notification template like the below:
Subject:
The agreement is reaching expiration in << Days Left to Expire >> Days
Body:
Hi Team,
The below Agreement will be expiring in <<Days left to expire>> days.
Account Name: <<company name >>
Agreement Name: << Agreement Label Name >>
End date of Agreement: << End date of Agreement >>
AT&T Engagement Manager: << pull the name from Relationship>>
Please provide the solution on how to get the above details.
Regards,
Mahesh