Trigger notification alternate month

Hafsa1
Mega Sage

I have a requirement to send notification to a group "HRSD EMEA" if case is still active based on opened time

Notification should trigger every first working day of alternate month starting  April  month. Means April, june, aug...and so on.

 

Can someone help with code.

 

1 ACCEPTED SOLUTION

piyushsain
Tera Guru
Tera Guru

Hi,

Please use this script in the condition of scheduled jobs.

var gdt = new GlideDateTime('2024-09-01 10:59:09');

var month = gdt.getMonthLocalTime();

var day = gdt.getDayOfMonthLocalTime();

var dayWeek = gdt.getDayOfWeekLocalTime();


if(month>4 && month%2==1 && dayWeek!=7 && dayWeek!=6){
    return true;
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Hafsa1 

 

For 2nd part:

https://www.servicenow.com/community/developer-forum/is-is-possible-to-create-custom-time-based-trig...

 

For 1st part

Get all records, and see if ant case is active

Action

Send notification 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

piyushsain
Tera Guru
Tera Guru

Hi,

Please use this script in the condition of scheduled jobs.

var gdt = new GlideDateTime('2024-09-01 10:59:09');

var month = gdt.getMonthLocalTime();

var day = gdt.getDayOfMonthLocalTime();

var dayWeek = gdt.getDayOfWeekLocalTime();


if(month>4 && month%2==1 && dayWeek!=7 && dayWeek!=6){
    return true;
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

Hi piyush,

field type is date only.

No issues,

Use GlideDateTime in such situation only the time will be 00:00:00 . GlideDate give some error

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain