Salesforce Trigger Concepts
The Components of a Trigger
Triggers are a tool that lets you easily automate if/then business processes through workflows. Every workflow consists of rules and at least one action. You can configure immediate actions, set a timed delay, or offset delay based on a custom date field.
Trigger: Identify When the Process Should Run
The trigger identifies when the process should run. CTM offers two main types of triggers for your automation needs:
- Activity (call started, form received, the call ended, data is retrieved, manual update, etc)
- Invocable (dependent on another trigger or voice menu)
Rules: Determine Whether or Not to Execute Actions
You can add as many rules as you want to each trigger or none at all. Each set of rules controls whether or not the trigger executes the associated actions in the workflow, if there are no rules the trigger will execute the actions. In each set of rules, you can apply filters to include or exclude activities. These filters can be based on almost any type of data in the Activity Log.
If the activity (call, text, or FormReactor) doesn’t meet the criteria, the triggers will skip those actions in the workflow and moves to the next set of rules.
Workflows: What the Triggers Should Do
When the rules (criteria) evaluate to true on an activity, the trigger executes the associated workflows or waits to execute them at the scheduled time.
- Each immediate workflow is executed as soon as the criteria are met as true.
- Each scheduled workflow is executed at a specific point in time, such as 1 hour after the call is completed, 15 minutes after the FormReactor is completed, or a specific date based on a custom field.
Regardless of when the workflow executes, here are some of the things you can do:
- Create records in Salesforce
- Update one or more related records in Salesforce
- Send the caller a text message and append it as a completed task.
- Append a FormReactor as a task to the Lead or Contact record.
If you need additional functionality beyond what’s available through triggers and workflows, consider creating a lambda function to execute custom code. Then call the lambda function from the trigger.
Build a Trigger
Here’s a common use case:
If a FormReactor is filled out (trigger) and it’s after business hours (rules), then append the FormReactor as an open Task with a due date of ‘today’ (action).
You can expand this trigger to include more rules and workflows. If a FormReactor doesn’t meet the criteria above then add additional rules and workflows. The example above wouldn’t send anything to Salesforce if we don’t find a matching Lead or Contact. You’ll need to add an additional rule and workflow to create a new Lead and append the FormReactor as a Task.
CTM Triggers will only do exactly what you tell it to, how you tell it, and when you tell it. If you want to update a task with the call status, you must set up the trigger to first find the task. We’ll also need to know when – are we updating at the start or after the call completes? If your trigger runs at the start of the call then the call status would be inserted as ‘In Progress’ but there may be a different outcome you’re looking to track such as ‘hang up’ or ‘completed’.
Build in a Test Environment
If your CTM plan includes the Salesforce integration then you will have access to create an unlimited amount of Sub Accounts and it is recommended to create a Sub Account for testing purposes. Build and test your triggers in a new CTM Sub Account linked with a sandbox environment in Salesforce. You will be able to identify any issues without affecting your production data.
Test as many permutations of your triggers as you can
As with all customizations in CTM and Salesforce, it’s important to test your work. Make sure that you test as many possibilities as you can think of. All calls have a beginning and an end, what happens in between can vary.