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.

Event Trigger

smithro
Tera Guru

Hi All,

 

Using the contract management module, i'd like to trigger an event 30 days before the end date of the contract to fire a notification.  Which condition operator would work best for this?

 

Thanks in advance.

1 REPLY 1

Runjay Patel
Giga Sage

Hi @smithro ,

 

Best way you can do is writing a scheduled job to check everyday.

 

 

var thirtyDays = new GlideDateTime();
    thirtyDays.addDays(30); // Adds 30 days to the current date

    var contractGR = new GlideRecord('ast_contract'); // Contract table
    contractGR.addQuery('end_date', thirtyDays); // Query contracts with end date 30 days from now
    contractGR.query();
    
    while (contractGR.next()) {
        // Trigger the event when condition is met
        gs.eventQueue('contract.expiry.notification', contractGR, contractGR.sys_id, contractGR.end_date);
    }

 

 

Please Mark Correct if this solves your query and also mark Helpful if you find my response worthy based on the impact.

Regards,

Runjay Patel