CAD · Question #252
Which of the following is a correct method to ensure that a scheduled job only runs during business hours?
The correct answer is C. Use a "Scheduled Script Execution" with a time condition in the script. To ensure a scheduled job runs only during business hours, you can include conditional logic within the scheduled script execution itself to check the current time.
Question
Which of the following is a correct method to ensure that a scheduled job only runs during business hours?
Options
- AUse a "Business Rule" with a condition on the time of day.
- BSet the "Run Once" option to only run during business hours.
- CUse a "Scheduled Script Execution" with a time condition in the script.
- DDefine business hours in the platform settings and reference them in the script.
How the community answered
(44 responses)- A9% (4)
- B16% (7)
- C73% (32)
- D2% (1)
Why each option
To ensure a scheduled job runs only during business hours, you can include conditional logic within the scheduled script execution itself to check the current time.
Business Rules execute based on database operations or record displays, not as standalone scheduled tasks that run at specific times.
The 'Run Once' option executes a scheduled job only a single time at a specific date and time, not recurrently within a business hours window.
A 'Scheduled Script Execution' (Scheduled Job) allows an administrator to define a script that runs at a specific interval. Incorporating a time condition within this script is the correct method to ensure the job's logic only executes when the current time falls within business hours.
While business hours can be defined, there isn't a direct platform setting that automatically restricts a scheduled job's execution to those hours without explicit scripting to reference and evaluate them.
Concept tested: Controlling Scheduled Script Execution with time conditions
Source: https://docs.servicenow.com/bundle/utah-application-development/page/script/server-scripting/concept/c_ScheduledJobs.html
Topics
Community Discussion
No community discussion yet for this question.