In addition to using custom objects related to tickets in ticket triggers, the Object triggers EAP introduces a new type of trigger: object triggers. Unlike ticket triggers that reference custom objects, object triggers are triggers that run based on custom object record events and update values in a custom object record's fields. For example, when an agent creates a new custom object record, the object triggers defined for that custom object fire and can update the record accordingly.
Understanding object triggers for custom objects
Object triggers can be created for custom objects. Just as ticket triggers run when a ticket is created or updated, object triggers run when the specified custom object's records are created or updated. When a custom object record event occurs, any triggers that exist for that object are evaluated. After all of that object's triggers are evaluated, one update is made to the record with all applicable changes. If there are two applicable actions that set a value for the same field, the last write will be the one you see.
For example, let's say you're an IT department using custom objects to manage assets, such as software licenses and laptop assignments. You have a custom object named Asset, which has a custom drop-down field named Type, a checkbox named Requires approval, and a lookup relationship field pointing to users named Asset owner. If you define an object trigger for the Asset object, any time an agent creates or updates an asset record, the trigger fires. You might create a trigger that automatically assigns a default user as the owner if Requires approval is checked and no Asset owner is specified in the record.
Determining which type of trigger to use
Determining which type of trigger to use is based largely on the event that you want to cause the trigger to run. If you want the trigger to run when a ticket is created or updated, use a ticket trigger. If, instead, you want the trigger to run when a custom object record is created or updated, you should use an object trigger.
Ticket triggers can update fields on the object it's based on (tickets) as well as some fields related to the object, such as requester (user) and organization. A ticket trigger can have conditions and actions based on a custom object as long as there is a ticket lookup relationship field pointing to the custom object. Object triggers only update fields for the object it's based on.
Anatomy of an object trigger
Object trigger conditions
Condition statements are essentially "if" statements that return results that meet the specified criteria. In a trigger, you can define two sets of conditions: all and any. When conditions are specified under Meet ALL of the following conditions, the custom object record must meet all of these conditions to be considered a match. Alternatively, a custom object record is considered a match if it meets at least one of the conditions specified under Meet ANY of the following conditions.
Condition statements are composed of a Category, an Operator, and a Value. For triggers based on standard objects, such as tickets, there is a predefined list of conditions available. That isn't possible for custom objects because all of the custom object's properties are defined with custom fields. Instead, a predefined list of operators is supported for each type of custom field. Current user and Update conditions are available in addition to the conditions based on the custom object's fields.
Operators supported for each condition:
Field type | Operators | Values |
---|---|---|
Checkbox | is | True or False |
Current user | is, is not | Select from agent roles and users. |
Decimal | is, is not, present, not present, less than, less than or equal to, greater than, greater than or equal to | Enter any decimal value. |
Drop-down | is, is not, present, not present | Select from the field's options. |
Integer | is, is not, present, not present, less than, less than or equal to, greater than, greater than or equal to | Enter any whole number value. |
Lookup relationship | is, is not, present, not present | Select from records of that target object. |
Multi-line | is, is not, present, not present, includes, doesn't include | Enter any text-based value. |
Regex | is, is not, present, not present, includes, doesn't include | Enter any value. |
Text | is, is not, present, not present, includes, doesn't include | Enter any text-based value. |
Update | is | A record was created or updated for the specified custom object. |
Object trigger actions
Action statements define what occurs if the condition statements are true and the trigger fires. Essentially, these are "then" statements. If your conditions are true, then perform these actions. Similar to the conditions, the available actions are determined based on the custom object's fields.
Supported actions by custom field type:
Field type | Action |
---|---|
Checkbox | True or False |
Decimal | Specify a decimal value. |
Drop-down | Select one of the field's options. |
Integer | Specify a whole number value. |
Lookup relationship | Specify an action for records of a related object. |
Multi-line | Set a text-based value. |
Regex | Set a value. |
Text | Set a text-based value. |
Creating an object trigger
To create an object trigger, use the Object tab of Triggers page in Admin Center.
To create an object trigger
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab at the top of the page, then click Create trigger.
- Enter a Name for your trigger.
- (Optional) Enter a Description for your trigger.
You can provide details about what the trigger does. You'll be able to search for triggers based on description.
- Select the Trigger object.
This can't be changed after the trigger is saved.
- Click Add condition to set up the trigger to meet All or Any conditions.
- Select a Category, Operator, and Value for each condition you add.
The field operator determines the relationship between the condition and the value. For example, if you select the field operator "Is", your condition will need to be equal to the value. See Object trigger conditions.
- Click Add action to set the actions that occur when trigger conditions are met.
- Select an Action and specify a Value for each action you add. See Object trigger actions.
- Click Create and set the trigger to Active or Inactive.
Managing object triggers
After you create an object trigger, change the order of them, modify their conditions or actions, clone them, deactivate them, or delete them.
Ordering object triggers
The Object triggers list is organized by object. Each object that has at least one trigger is ordered alphabetically, with the object's triggers below it. Whenever a record is created or updated for an object with triggers, the object triggers are all evaluated and then all actions happen at once. That means the first object trigger's actions can't influence whether the record satisfies the conditions for subsequent object triggers in the list.
Object triggers can be reordered, but only relative to other triggers for that same object. Object triggers can't be moved or reordered across objects.
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab at the top of the page.
- Click Edit order.
- Select the Trigger object for which you'd like to reorder the triggers.
- Drag and drop the triggers into the desired order.
- Click Save.
Editing object triggers
Everything except the trigger object value can be edited after an object trigger is created.
To edit an object trigger
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab.
- Click the name of the object trigger you want to edit.
- Modify the name, description, conditions, and actions as needed.
- Click Save.
Cloning object triggers
Sometimes you want to create a new trigger that is almost identical to an existing trigger, but adjusted slightly. In this case, you can clone the existing trigger.
To clone an object trigger
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab.
- Click the name of the object trigger you want to clone.
- Click Actions and select Clone.
A copy of the trigger is opened to edit.
- Adjust the cloned object trigger as needed, then click Create and set the trigger to Active or Inactive.
Deactivating object triggers
If you decide that you no longer need a trigger, you can either delete it or deactivate it. Deleting a trigger means that it's gone and can't be retrieved. If you may want to use a trigger again in the future but don't currently need it, you can deactivate it. Deactivated triggers are found by selecting Inactive from the Status drop-down at the top of the trigger list, and can be reactivated if needed. If you reactivate a trigger, it won't retroactively run on object records that were previously created or updated.
To deactivate an object trigger
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab.
- Click the name of the object trigger you want to deactivate.
- Click Actions and select Deactivate.
Deleting object triggers
If you decide that you no longer need a trigger, you can either delete it or deactivate it. Deleting a trigger means that it's gone and can't be retrieved. If you decide to permanently delete a trigger, you must first deactivate it.
To delete an object trigger
- In Admin Center, click Objects and rules in the sidebar, then select Business rules > Triggers.
- Click the Objects tab.
- Select Inactive from the Status drop-down at the top of the trigger list.
- Find the object trigger you want to delete, click the options menu icon () and select Delete.
If you're already viewing an inactive object trigger, click Actions and select Delete.
- In the confirmation dialog, click Delete trigger.