- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 10:16 PM
hi.
i neeed to make Scheduled job trigger on every month second tuesday.
but i'm newbie on code.
i think i need to write code range setting second week and will be work
help me please
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 05:59 AM - edited 11-21-2023 06:00 AM
Hi @omeo
You can use the GlideDateTime class and the getDayOfWeek() function will give you the numerical value of the day (for which Tuesday is 2) and then getDayOfMonth() to work out if it's the second week (for which anything greater than 7 but smaller than 14 would represent the second week).
GlideDateTime | ServiceNow Developers
Let me know if you need anything further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 05:52 AM
Hi @omeo
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 05:59 AM - edited 11-21-2023 06:00 AM
Hi @omeo
You can use the GlideDateTime class and the getDayOfWeek() function will give you the numerical value of the day (for which Tuesday is 2) and then getDayOfMonth() to work out if it's the second week (for which anything greater than 7 but smaller than 14 would represent the second week).
GlideDateTime | ServiceNow Developers
Let me know if you need anything further.