Notification has to be sent out exactly before 30 days

Mounika M
Tera Contributor

Hi Team,
I have requirement, that i need to send notification exactly before reassessment date. Could you please help me on this. ?i have tried this in encodedquery '

u_reassessment_dateRELATIVEEE@dayofweek@ahead@30' it is working fine but how can we apply this on filter. Could anyone please help me on this.

Thanks in Advance!
3 REPLIES 3

M Ismail
Tera Guru

Hi @Mounika M,

Check out this 

MIsmail_0-1710921026745.png

when i copy the query it's give me 
opened_atRELATIVEGT@dayofweek@ahead@30
 as I don't have u_reassessment_date so I used the opened_at 

// Create a new GlideRecord object for your table
var gr = new GlideRecord('your_table_name');

// Add a filter condition for the reassessment date
gr.addEncodedQuery('opened_atRELATIVEEE@dayofweek@ahead@30');

// Execute the query
gr.query();

// Loop through the records
while (gr.next()) {
// Do something with the records, such as sending notifications
// For example:
gs.info('Send notification for record with ID: ' + gr.sys_id);
}


Please hit helpful and accept this as a solution if it solved your problem.
Thank you!

Maddysunil
Kilo Sage

@Mounika M 

Where do you want to apply this filter?I would suggest to apply in business rule and trigger the event to send notification, below code example:

 

var gr = new GlideRecord('[Your_Table_Name]');
gr.addEncodedQuery('u_reassessment_dateRELATIVEEE@dayofweek@ahead@30');
gr.query();

// Loop through matching records
while (gr.next()) {
    // Send notification for each record asynchronously using gs.eventQueue()
    gs.eventQueue('send_notification', null, gr);
}

 

  

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

 

Thanks