Vancouver - Scheduled Script Executions and Events Flashcards
DEVELOPER TIP: Although not the primary use case, ___ ___ ___ are useful for testing server-side script logic because they can be configured to execute on demand.
DEVELOPER TIP: Although not the primary use case, Scheduled Script Executions are useful for testing server-side script logic because they can be configured to execute on demand.
DEVELOPER TIP: To run a Scheduled Script Execution on the last day of the month, configure a monthly Scheduled Script Execution set to run on day __. The Scheduled Script Execution will run on the last day of the month, even for months with fewer than __ days.
DEVELOPER TIP: To run a Scheduled Script Execution on the last day of the month, configure a monthly Scheduled Script Execution set to run on day 31. The Scheduled Script Execution will run on the last day of the month, even for months with fewer than 31 days.
Scheduled Script Executions are not associated with ___ and have no access to the ___ or ___ objects used by many other server-side script types.
Scheduled Script Executions are not associated with records and have no access to the previous or current objects used by many other server-side script types.
Scheduled Script Executions have two scripting fields:
___
___
Scheduled Script Executions have two scripting fields:
Condition
Run this script
The Condition script shown tests what? The script returns true only for ___.
If today is a weekday or weekend. Weekdays
The server-side script logic in the Run this script field executes when the Scheduled Job is triggered and the Condition script returns true.
The script shown queries the database for?
The server-side script logic in the Run this script field executes when the Scheduled Job is triggered and the Condition script returns true.
The script shown queries the database for Occasion records that match today’s month and day and logs the record numbers in the Application Log (System Logs > System Log > Application Logs).
Variables declared in the Condition script are known to the ___ ___ ___ field if permitted by the rules of JavaScript scope.
Variables declared in the Condition script are known to the Run this script field if permitted by the rules of JavaScript scope.
NOTE: If the Scheduled Script Execution includes a Condition script, the Condition script must set the answer variable to true for the Run this script field’s script to execute, even when using the ___ ___ button to test the Scheduled Script Execution.
NOTE: If the Scheduled Script Execution includes a Condition script, the Condition script must set the answer variable to true for the Run this script field’s script to execute, even when using the Execute Now button to test the Scheduled Script Execution.
Where would I find the outputs of the following line in a scheduled script that was executed:
gs.info(‘This is the text’);
System Logs > System Log > Application Logs
I’m not sure that this is true if the application isn’t scoped (this was done in the needit application via studio)
What is the following solution doing:
var rightNow = new GlideDateTime();
var dueSoon = new GlideRecord(‘x_58872_needit_needit_task’);
dueSoon.addQuery(‘due_date’,’>=’,rightNow);
dueSoon.addQuery(‘due_date’,’<’,gs.hoursAgo(-24));
dueSoon.addQuery(‘state’,’!=’,3);
dueSoon.query();
This code gets NeedIt records that are due in the next 24 hours that are not already in a state of complete.
This solution uses the GlideSystem hoursAgo() method. When passed a positive number, the method looks into the past. When passed a negative number, the method looks into the future. It may seem counterintuitive for a negative number to reference the future. The method is hoursAgo(), which is why positive numbers are in the past. Two hours ago is a positive number.
Events are an indication in ServiceNow that something notable has occurred. Events can be generated by server-side scripts, workflows, ServiceNow processes, or by user actions such as:
____
____
____
____
Events are an indication in ServiceNow that something notable has occurred. Events can be generated by server-side scripts, workflows, ServiceNow processes, or by user actions such as:
Impersonating a user
Logging in
Viewing a record
Modifying a record
Each event is an entry in an event queue and not an action. Unless logic is created to respond to events, nothing happens with an event after it is generated. Responses can be:
___ ___
___ ___ (server-side script)
Each event is an entry in an event queue and not an action. Unless logic is created to respond to events, nothing happens with an event after it is generated. Responses can be:
Email notification
Script Action (server-side script)
The generalized process to work with events is:
_____
_____
_____
The generalized process to work with events is:
Add event to the Event Registry (not needed if you generate an already registered event).
Generate the event.
Respond to the event.
There are two ways to generate events:
_____
_____
There are two ways to generate events:
Server-side script
Workflow Create Event activity
The ___ and ___ methods are part of the GlideSystem server-side API. Use the ___ and ___ methods to generate events in server-side scripts.
The eventQueue() and eventQueueScheduled() methods are part of the GlideSystem server-side API. Use the eventQueue() and eventQueueScheduled() methods to generate events in server-side scripts.