Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Contract Management - Contract Threshold breached Notification

pavi12
Tera Contributor

I have a requirement that is 

WHEN the Contract is about to reach the end date or expiry               

 

THEN automated notifications or alerts should be sent to abc@email id  based on the frequency mentioned below

1. Every week when 1 month is left

2. Everyday when 1 week is left 

 

How to achieve this?

Could you please help me on this?

 

Thanks,

Pavithra

3 REPLIES 3

Laveena-Agarwal
Mega Sage

Hi @pavi12 

Easy Solution -

Implement a daily Scheduled Script Execution to evaluate records against their expiry date.
Based on the remaining time to expiry, trigger appropriate events, which in turn drive email notifications.

 

Optimized Solution -

 

1.Create a Choice field on contract table, for an example - Expiry Phase

Value Meaning

healthy> 30 days
monthy_warning30–8 days
weekly_warning≤ 7 days
expired< 0 days

 

2.Scheduled Script Execution (Daily)

Set the "expiry status" field based on end date or expiry date.

var today = new GlideDate();

var gr = new GlideRecord('u_contract');
gr.addNotNullQuery('expiry_date');
gr.addQuery('expiry_date', '>=', today.getValue() - 1);
gr.query();

while (gr.next()) {

    var expiry = new GlideDate();
    expiry.setValue(gr.expiry_date);

    var daysLeft = GlideDate.subtract(expiry, today).getDayPart();

    var newPhase =
        daysLeft > 30  ? 'healthy' :
        daysLeft > 7   ? 'monthly_warning' :
        daysLeft >= 0  ? 'weekly_warning' :
                         'expired';

    if (gr.u_expiry_phase != newPhase) {
        gr.u_expiry_phase = newPhase;
        gr.update(); 
    }
}

3. Business Rule - Fire Event ONLY on Phase Change

4. Notification Logic (Based on Event)

 

Compute expiry once → store expiry phase→ trigger only on phase change

No daily scanning of all records. No repeated math.

 

 

 

Hi @Laveena-Agarwal,

 

Thanks for the reply.

 

Already we have the OOTB notification called Contract Threshold breached and also we have clm_condition_check_list 

 

Sample OOTB for 120 days?

 

pavi12_1-1767344208833.pngpavi12_2-1767344214430.png

 

Here you can see the event name called contract.expiration.

 

How we can approach on this clm_condition_checker?

 

Thanks,

Pavithra

 

Oh in that case , You can follow the steps listed here-

Configure reminders for expiring contracts