- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2025 01:00 PM
I have a requirement to perform an action on changes if certain criteria is not met on changes. Whats needed is to check today at 9:00 if changes that will be implemented today are not ready for CAB to automatically reschedule them. I have that part figured out. However, included in that needs to be changes that are planned to be installed tomorrow prior to 9:00 need to be rescheduled as well.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 07:14 AM
Try to add one more condition
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
‎01-14-2025 01:12 PM
You may need to put 'hour','10','LE' in double-quotes instead of single quotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 12:39 PM
I think I am following -- you are struggling to identify changes after today but prior to tomorrow at 9am. Since you already have today figured out, you just need changes prior to tomorrow at 9am. You will likely need to grab the current date in a script, add a day, store that an a variable, and then append an OR condition to your encoded query:
// Get the current date
var currentDate = new GlideDate();
// Add one day to the current date
currentDate.addDays(1);
// Format the new date as YYYY-MM-DD
var tomorrowDate = currentDate.getByFormat('yyyy-MM-dd');
// Append the below line to your encoded query:
//start_date<javascript:gs.dateGenerate(tomorrowDate,'09:00:00')
Give that a try and see if it works. Just a note that I believe some of the GlideDate functions are limited by scope. If you run into that issue I'd turn to the docs to check what function you can call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 07:14 AM
Try to add one more condition
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
‎01-14-2025 12:43 PM
Thank you for providing the missing piece and I can pull up tomorrows changes before the 9 is list view, however when I copy the query to put in my encoded query I receive compiler errors. Here is what I tried:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2025 01:12 PM
You may need to put 'hour','10','LE' in double-quotes instead of single quotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2025 07:15 AM
Thank you for that, it will let me compile it now. I am testing by using it as a background script however, I am facing some testing issues in getting the right information returned.
My script returns this information:
*** Script: Changenumber is CHG0088545
*** Script: Planned install time is 2025-01-16 15:00:00
*** Script: Total number of changes 1
However the actual date shows as
01-16-2025 07:00:00
Im not sure what time that would be converted to.