Overview
Advanced Users Only
InFocus Jobs applet allows you to enter scripts to be run on a schedule from the SQL Server.
Available from Administration>InFocus Jobs, SQL Queries or Powershell scripts are entered as steps that define the order in which they are run. Once entered, a schedule is defined for the job which governs when, how and by whom the queries are executed (details below). A running History can be reviewed for each job.
Technical Note
Self-Hosted Clients
InFocus Jobs are processed using a single stored procedure, InFocusJobs_Process_Sav, on the SQL Server. To enable this feature, you’ll need to complete InFocus Jobs Server Setup.
If you’re on InFocus Cloud, you’re all set- we manage this for you.
Key Concepts
Permissions
Access Permissions to InFocus Jobs applet are established to this new applet via Administration>Permissions.
Steps
As stated above, scripts are entered as steps and listed in the order of execution. InFocusJobs_Process_Sav iterates through each script in the steps and reports back successes or failures for the job through the History Tab.
Executing InFocus Jobs
InFocus Jobs can be run on demand, according to a schedule or triggered via webhook.
On Demand
Jobs can be run on demand by selecting the Job and clicking Execute Job from the toolbar.
Scheduled Jobs
Jobs can be run on a schedule as often as every 5 minutes. Jobs can also be run as a designated employee- if your script uses employee variables (e.g. @MYID@).
Missed Runs
In that InFocus Jobs are processed on an automated schedule, a plan must be in place for scenarios where the job cannot be executed (e.g. power outage, etc.).
InFocus Jobs run on a counter system, where each run increments the Next Run Date based on a defined recurrence (e.g. Recurring every 1 Day(s)). When a run is missed (e.g. the stored procedure is not executed), the Next Run Date is not incremented until the next time the job is run. At that time the Next Run Date will be incremented according to one of two settings: Skipped Missed Runs or Process Missed Runs.
• | Skipped Missed Runs - Default setting. Increments the Next Start Date from the current date of the run based on the defined recurrence |
• | Process Missed Runs - Increments the Next Start Date from the previously successful run's Next Start Date based on the defined recurrence |
Webhook
Jobs can be triggered via incoming webhook. To configure, each job will need to be configured with the following
• | Webhook Code - Each job must be assigned a unique code to be contained in the webhook URL. Webhook codes can be generated or entered manually- however if entering manually they should be secure. |
• | Expiration Date - Expiration date for the webhook |
• | Webhook URL - The URL used to execute the job. The request should use the POST HTTP Method. It can also include a JSON Body that the job can access through the $infocus.input parameter. |
Tutorials
Creating an InFocus Job
1. | Browse to AD>InFocus Jobs |
2. | Click New from the toolbar |
3. | Name and Describe the Job |
4. | From the Steps tab, add SQL Scripts to be processed by the job. As needed, this can be spread across multiple steps. |
c. | Note, jobs default to a type of SQL. If using Powershell, designate this using the Powershell radio button |
d. | Enter the SQL/Powershell Script |
e. | Additional Steps can be added |
f. | Steps can be ordered/reordered using the up and down arrows (^, v) located at the bottom of the Steps tab. |
Manually Running a Job
Once entered and saved, an InFocus Job can be kicked off manually from the InFocus Jobs applet by clicking Execute Job from the toolbar.
Field Descriptions
Menu
• | File/Help - Lists standard InFocus File and Help options |
Toolbar Buttons
• | New - Creates a new InFocus Job |
• | Save - Saves the InFocus Job |
• | Copy - Copies the InFocus Job |
• | Delete - Deletes the InFocus Job |
• | Refresh - Refreshes the applet |
• | Execute Job - Executes the currently loaded job |
InFocus Jobs Grid
• | InFocus Jobs Grid - Lists all InFocus Jobs and the next scheduled run date |
Jobs Header
• | Active - Defaults to checked. Check if the job is active |
• | SQL - Defaults to checked. Check if using SQL Scripts |
• | Powershell - Check if using Powershell Scripts |
• | Clear History - Clears history displayed in the History tab for the loaded job |
• | Job Name - Name of the job |
• | Descriptions - Job description |
Steps Tab
• | Steps Grid - Lists the SQL Scripts to be run in the order of execution (e.g. Step 1, Step 2, Step 3, etc.) |
• | Add Button (+) - Adds a new step |
• | Delete Button (x) - Deletes the currently loaded step |
• | Up/Down Arrows (^, v) - Used to reorder the currently loaded step |
• | Step Name - Name of the step |
• | Stored Procedure - Check if the script is a call to a stored procedure |
• | Replace System Variables - Check to indicate that the script uses InFocus Variables which should be inserted at run-time. |
• | Script Editor - Used for entering and editing SQL queries |
Schedule Tab
• | Next Run Date / Time - Check to enable. Enter the next date/time the job should be run |
• | Recurring Every - Defines how often the job should be run. Supports as often as every 5 minutes. |
• | Employee Context - Employee to insert if the job utilizes employee variables |
• | Skip Missed Runs - Default setting. Increments the Next Start Date from the current date of the run based on the defined recurrence |
• | Processed Missed Runs - Increments the Next Start Date from the previously successful run's Next Start Date based on the defined recurrence |
• | No End Date (Job Duration) - The job will be processed indefinitely |
• | End Date (Job Duration) - Sets an end date for job processing |
Webhook Tab
• | Webhook Code - Unique code to be used in the webhook URL. Webhook codes can be generated or entered manually- however if entering manually they should be secure. |
o | generate (link) - Generates a unique 32bit code |
• | Expiration Date - Expiration date for the webhook. Once passed, the listed webhook will no longer trigger the job. |
• | Process Webhook as GET - When checked, the loaded InFocus Job will be triggered by HTTP GET requests to the listed webhook URL. By default the InFocus Job can only be triggered by POST requests made to the webhook URL. |
• | Webhook URL - The URL used to execute the job. The request should use the POST HTTP Method. It can also include a JSON Body that the job can access through the $infocus.input parameter. |
• | View linked Events - Click to view Event Manager events calling the listed webhook. |
History Tab
• | Job Log ID - Internal log ID |
• | Start Date - Job Start Date |
• | Completed - When the job was completed |
• | Completed (Checkbox) - Job Completion status (True/False) |
• | Error (Checkbox) - Job Error status (True/False) |
• | Message - Job results message (e.g. Compete, Error message, etc.) |
|