How to differentiate the uses of New and Old attributes when setting up criteria in Triggers

Updated on May 9, 2020 06:51AM by Admin

Triggers are used to generate an action whenever criteria match in the records. In the criteria section of the trigger page, you can choose either old or new attributes.

Criteria

Old - Old is chosen for an attribute that already has a value in it. On selecting old, a trigger will be generated if the record has the value mentioned in the criteria. Old attributes are when a record is updated or deleted.

When you make any other changes (other than in the mentioned attribute) or delete a record that has the value mentioned in the criteria, then trigger will be generated.

New - New is selected when a value is added to the attribute. This added value is checked to see if the criteria match to generate a trigger. New attributes are used when a record is created or updated.

When you create or update a record, the value mentioned in the criteria must be added to the attribute, only then a trigger will be generated.

Instance 1: Generating trigger for an Old Attribute

  • Consider configuring a trigger where an attribute is to be updated if the criteria match. The event chosen is to update the contacts in the Contacts App.
  • When the Contact Type is Billing, then the action is to update the Assigned To to Nadia James.
Old Type Trigger

  • Consider navigating to a record whose Contact Type is Billing.
Overview

  • Here, the status is Active and Assigned To is Caroline Forbes. When the status is changed to Inactive, the Assigned To will automatically change to Nadia James.
Old Type Update

  • This is because the record has the Old - Contact Type as Billing that matches the criteria.

Instance 2: Generating trigger for a New Attribute

  • Consider configuring a trigger where an attribute is to be updated if the criteria match. The event chosen is to create a contact in the Contacts App.
  • While creating a contract, if the Contact Status is Active, then the action is to update the Assigned To to Peyton Daniel.
New Type Trigger

  • Consider creating a record whose Status value is added Active.
Contacts New Type

  • Here, the Assigned To is Caroline Forbes. As soon as a contact is created, the Assigned To has changed automatically to Peyton Daniel.
  • This is because the status criteria match in the record.
Contact Updated