Triggering Custom Code 
Triggers and actions allow you to interact with changes that occur in the system. You can trigger code to run in-between jobs, to prepare the environment, for example, or react on a job change or status with triggers and job definition actions. The main difference between the two is the scope. Actions are limited to the object, and triggers are global and apply to all job definitions (Before Job triggers) or all objects (Before Definition Change trigger).
When you want to trigger code for jobs, you should decide which solution to implement based on the amount of affected job definitions and the total amount of job definitions that you use regularly. Triggers are a little more expensive in terms of performance, because they fire for every job. Actions require you to specify them on every affected job definition.