Want to send notification on last day of every month using scheduled job

--oooo--
Tera Contributor

Hello Experts,

I want to send a notification on the last day of every month .how can I achieve this using the scheduled job please guide me.

thank you.

10 REPLIES 10

Community Alums
Not applicable

You can create an event that will be triggered by the scheduled job (runs at 30th of each month) and setup notification to be triggered by said event.

Roshan Tiwari
Tera Guru

Hi @--oooo-- ,

 

Please write schedule script execution and write script to log an event.

 

gs.eventQueue("event_name", glideRecord object, parm1 ( sys_id of user whom you want to send, parm2 (optional));

--oooo--
Tera Contributor

Hello @Community Alums  @Roshan Tiwari ,

I know how to send notifications using Event Queue. I want to send a notification on the last day of the month.

suppose the month is feb then it should send a notification on 28th Feb.

please guide me thank you.

Hi @--oooo-- ,

 

You can use below class: Values I have entered is just for example.

 

var gdt = new GlideDateTime(); //December

gs.print(gdt.getDaysInMonth());

 

Output will be 31.

 

var gdt = new GlideDateTime();

gs.print(gdt.getDayOfMonth());

 

output will be 2.

 

Just compare like \:

if(gdt.getDayOfMonth() == gdt.getDaysInMonth()){

"here you find last day of month"

}