In addition to using custom objects related to tickets in ticket triggers, you can also define triggers that run any time an object's record is created or updated. These are called object triggers. 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.
Requirements and limitations
- You've activated custom objects.
- You've created at least one custom object.
- Object triggers only support custom objects.
- You can have a maximum of 100 active triggers per object.
- You can create a maximum of 500 triggers total, including active and inactive triggers, per object.
- An object trigger can contain a maximum of 50 total conditions. This includes both "all" and "any" conditions.
- Within an object trigger condition that supports multi-select, you can select a maximum of 50 values.
- An object trigger can contain a maximum of 25 actions.
- An object trigger can't exceed 64 KB in size.
Understanding object triggers for custom objects
Object triggers are created and managed on the Object tab of the Triggers page in Admin Center.
Object triggers can be created only 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, or you might want to define a trigger that notifies the asset owner any time their asset's record is updated or a new asset is created and they're listed as the owner.
Determining which type of trigger to use
Determining which type of trigger to use is based largely on the type of event that results in the trigger running. If you want the trigger to run when a ticket is created or updated, use a ticket trigger. If you want the trigger to run when a custom object record is created or updated, use an object trigger. Both ticket triggers and object triggers can update fields on the object it's based on as well as fields related to the object. That means 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 that custom object. Likewise, an object trigger can have conditions and actions based on tickets if the custom object contains a lookup relationship field pointing to a ticket.
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.