There are 3 main automation tools used in Salesforce: Workflow Rules, Process Builder and Flow Builder. Salesforce have announced that they will be retiring Workflow Rules and Process Builder with the future for creating automations being Flow Builder.
You can automate your SMS messages in Salesforce via Flow Builder. This is done via the Flow builder in the setup menu and becomes quite simple once you get the hang of it. This article will talk through how to create a new, simple Flow, designed to send an SMS to new leads as they're created, including selecting trigger objects and setting conditions.
If you already know how to set up a Flow, you can skip this first part and jump straight to where you learn how to add SMS to your Flows instead.
Creating a Flow
1. Go to the Flow builder in the Salesforce setup menu by going to Setup, then Process Automation, then Flows:
2. Select New Flow:
3. Choose the type of Flow you want to build. In this example, since we want to send an SMS triggered by a change to a customer record, we're going to select Record-Triggered Flow:
4. The first thing you're asked is what object is triggering the Flow. In this example, we're going to use a Lead as our triggering object:
5. Since we want to send an SMS to leads as they're created, we need to choose the option to trigger our Flow whenever A record is created or updated:
6. Next, we need to set our condition requirements. In this case, we're only going to set one condition and we need that condition to be met in order for the trigger to fire. So, we're going to select All Conditions Are Met (AND) as our requirement:
Other condition requirements allow for more complex triggering options - but we're not going to worry about those right now.
7. Ok, so now we need to actually set our conditions. Like I said, we're only using one very simple condition for this Flow - and that is that there must be a mobile phone number present in the lead record, otherwise we'll just get a bunch of errors when Mercury tries to send SMS messages to records with no mobile numbers:
8. Select the option to run the flow Only when a record is updated to meet the condition requirements:
Now we just need to click Done, and we can see the Flow starting to take shape:
At the moment, we have a trigger and a condition, but no action. This means that when a new lead is created, and the condition is met.....nothing will happen.
So, let's add an action to send an SMS...
Adding SMS to the Flow
If you're not already familiar with Flows in Salesforce, there are a couple of things to be aware of before beginning this process.
First of all, SMS messages are based on templates. This means that you can't write your message while you're setting up your Flow - you'll need to have one pre-prepared and saved as a template beforehand. Read this article to find out how to do that.
The other thing to note is that the action of sending an SMS in Salesforce is referred to as "creating an SMS record." This will become important in just a moment.
Ok, let's get cracking...
1. Click the "+" icon to add a new element to your Flow:
2. In the drop-down list, scroll down to the Data section and select Create Records (see now why we explained the whole "creating records" thing?)
3. Create a Label for the SMS record, then hit the Tab key and you'll see the API Name field will populate automatically based on your label:
Note - the Label can be anything you want, but it's best to make it relevant so we've called ours "SEND SMS".
It's a good idea to add a description as well so that anyone reviewing the Flow in the future will understand what this SMS is actually for:
4. Select the number of records to create. In this case, this means how many SMS messages you want to send to each new lead - which is one:
5. Choose how to set the record fields. Since we want to tell the system who to send to, what number to use, what template to use etc., we'll choose the option to use separate resources and literal values:
6. Next, we need to tell the system what type of object to create a record for. When it comes to triggering an SMS from a flow, you need to select Task:
7. Now we need specific values for the Task record. The task for an SMS should always comprise of the following 5 fields:
-
-
- Activity Date
- Description
- Owner Id
- Subject
- Who Id
-
-
ActivityDate
In the Field box select ActivityDate, then in the Value box select $Flow, then current date, and it will populate with the current date:
-
Description
Then add another field called Description - remember how we told you that SMS messages are all based on pre-saved templates? Well, this is where you tell the system exactly which template to use for your message.
The template contains a lot more than just the message content - it includes the phone field you want to send the message to, the sender ID, any merge fields you want to use in your message, and the account owner ID.
To populate the value box, you need to use a very specific format:
{"template":"SMS_CODE"}
"SMS_CODE" refers to the SMS Code which appears on the template you want to use for this message:
So, in this example, the Description field would be populated like this:
{"template":"a035j000008W3IeAAK"}
-
OwnerId
Add another field called OwnerId - this will be the owner of the Flow, unless your template is configured to send from another account, such as the company default account. If you want to send your message from a specific account (say for example there's an account with a specific sender number attached to it that you want to send from), then you can override the template setting by clicking the Override with User's Default Account box in the template:
To configure this field to send from the owner of this Flow, select Record > Owner ID (User) > User ID:
-
Subject
Add another field called Subject - this is a free-text field where you can add any text you want, and the task and outgoing message will be tagged with that subject:
Note - the subject is not seen by the customer/recipient and is useful for internal reporting and reply tracking.
-
WhoId
Add another field called WhoId - this is the specific internal reference that the SMS record will be attached to, in this case it's Record > Lead ID. This tells the system which leads each SMS was sent to, and subsequently which leads any replies should be tracked against:
Now all that's left to do is click Done and Save, and your Flow is ready to go - just remember to activate it!