Send Notification 24 Hours Prior To Planned Start Date

tiguin2798
Tera Guru

Everyone,

I am trying to have a notification fire on an event when a change is 24 hours prior to the planned start date if it contains a critical system. I have created the event and scheduled job, but it does not appear to be firing. This is my first time creating a scheduled job so I am unsure if that (or my code) may be configured incorrectly.

Also in this case, would the 24 hour prior to the "Planned Start Date" portion even need to be included in my notification conditions? Or would this be something that is scripted into my scheduled job?

tiguin2798_0-1716577437749.pngtiguin2798_1-1716577443265.pngtiguin2798_2-1716577444848.png

 

11 REPLIES 11

Abhit
Tera Guru

Hello @tiguin2798 

 

2 things needs to be updated..
In your scheduled job addEncodedQuery quotation are missing  and as Sanjiv said, you need to update the event name & state condition too.

//Scheduled job query
gr.addEncodedQuery("active=true^start_dateRELATIVEGT@hour@ahead@24^state=-2");

//Event as per notification
gs.eventQueue('critical.change.24.hours',gr);

 

Cheers!!

tiguin2798
Tera Guru

Thank you everyone for your responses! I will preface my response with I do not have prior scripting experience. What I have created thus far was based off of other community post.

With this being said I have taken the replies given and attempted to update the script for my scheduled job to include the annotations as well as adding the state to the query. I also created a business rule to run after insert and update that should trigger the scheduled job. Can someone check my screenshots below and confirm that this should work as expected as I am still learning the platform?

Thank you in advance!


tiguin2798_3-1716911308637.pngtiguin2798_4-1716911317373.pngtiguin2798_5-1716911332927.pngtiguin2798_6-1716911340090.png

 

 

I dont think you need a scheduled item and business rule.

 

What you need is a scripted scheduled job and add the script in the scheduled item to the scheduled job.


Please mark this response as correct or helpful if it assisted you with your question.

In this case would removing the business rule and having the script in the scheduled job below suffice? Granted the script below is correct.

 

tiguin2798_1-1716918599202.png

 

 

Yes..Because in the Scripted Schedule job, you can run it to job on a Daily basis. The script in the scheduled job will take care of querying the change requests and triggering the event, which will then trigger the notifications.


Please mark this response as correct or helpful if it assisted you with your question.