AX2530
Creating event handlers for a job
You can create user-defined event handlers in a job, for the purposes of automatically triggering the job for execution when the event name is called by another feature. Axiom Software supports several features that can be used to raise an event:
- The RunEvent function and command
- File Group triggers
- The Raise Event Scheduler task
Event handlers are defined by name. Multiple jobs can have an event handler with the same name. When that event handler is called, it will affect all jobs that contain the event handler with the matching name.
To create an event handler in a job:
-
In the Scheduler dialog, open a job to edit or create a new job.
-
In the left-hand side of the job, select Event Handlers.
-
On the Job tab of the ribbon, in the Event Handlers group, click Add.
A new event handler is added to the job.
-
Double-click the Event Name field so that the field becomes editable, and then type the desired event handler name.
For example, if the event handler will be used to trigger Process Plan Files jobs, you might name the event handler ProcessPlanFiles.
This event name is the name that will be used in features such as RunEvent to trigger this job for execution.
- In the Execute As field, select one of the following to determine the user identity that will be used to run the job when it is executed via the event handler:
Owner: The job will be run under the identity of the job owner.
The job owner is the user who last saved the job. If you are not sure who the current job owner is, you can check the Job Variables tab. The current job owner is listed in the System defined values section.
- Requester: The job will be run under the identity of the user who triggered the event handler.
By default, event handlers are set to run as the Owner. You should carefully consider this option as it may affect whether the job can be run and how the job is run.
For example, if the event handler is set to Requester, but the user who triggered the job does not have access to the file group specified for a Process Plan Files task, then the task will fail.
This may be the desired outcome—you may want the job to be dependent on the user's rights, and therefore you should specify Requester. On the other hand, you may want the job to run in the same way every time, regardless of the user that triggers the job. In that case you should specify Owner.
By default, the event handler is set to Active, which means it will be found by any process that triggers the event handler. If you want to temporarily exclude this job from event handler processing, you can clear the Active check box.
Deleting an event handler
If you no longer need an event handler, you can delete it from the job. Select the event handler and then click Remove Selected. You can also Clear All to remove all event handlers from the job.
User-defined event handlers display along with the system event handlers in the Event Handlers tab (Service > Event Handlers). If you right-click a user-defined event handler in this location and select Remove event handler, it does not delete the event handler from any jobs that use it, but it does set the event handler to inactive.