Search
Close this search box.

Salesforce Workflow Rules, Part 2: Making Them Do Stuff

Red Argyle Logo without name
Red Argyle logo

When my previous blog post about workflow rules went live, someone commented to me on Twitter that they seemed like magic. I responded to this with one of my favorite quotes, which is Clarke’s Third Law: “Any sufficiently advanced science is indistinguishable from magic.” To the unfamiliar or uninitiated, the creation and function of workflow rules can seem like an arcane art. But once you understand them, you’ll have mastered an essential tool of the experienced Salesforce admin.

In my previous post, I discussed some of the basics of workflow rules, and how to configure their criteria. Now I want to get into some more details about what workflow rules can do in the system, as well as offer some examples of workflows I’ve found useful in the past. As a reminder, the four types of actions a workflow can perform are creating tasks, sending e-mails, updating fields, and sending outbound API messages. I’m going to focus on the first 3 of these, as those are where you’ll probably spend most of your time. But first…

Timing is Everything (and a little tricky)

When you set up a workflow action in Salesforce, you can tell the action to trigger when the workflow fires, or at a specified later date. (Note: you can’t do a time-delayed action if your workflow fires on every edit.) These dates can be relative to when the workflow was triggered, or to a date field present on the record itself. When setting up a time-delayed action, it’s important to remember that Salesforce will double-check the record before the time-delayed action happens; if the record no longer meets the criteria, it’ll disable the delayed action.

As an example, let’s say you have a workflow on Opportunity that sends an e-mail to your finance team two days before the Opportunity’s Close Date if the Amount is over $500,000. As soon as the Opportunity’s amount goes over $500k, the action is put in a queue. Two days before the close date, Salesforce double-checks to make sure that the Opportunity’s Amount is still over $500k; if it isn’t, then it cancels the e-mail.

Creating Tasks with Workflow Rules

The first thing you can do with a workflow action is create and assign a task. The task can be assigned to a specified user or role in the system, or to the owner of the record that triggers the workflow. You can also specify the task’s due date, relative to either the trigger date or a date field on the record. This is the go-to option for notifying Salesforce users of things that are going on in the system, especially when it requires some action on their part.

Sending E-mails with Workflow Rules

Workflows can also send e-mails from Salesforce, using Email Templates you’ve created in the system. You get a lot more options for who can get e-mails generated this way, including the record owner, the record creator, roles and groups in Salesforce, related contacts, e-mail fields on the record, and even related users on the record. You can also specify arbitrary e-mail addresses to receive a copy of the e-mail when it goes out. These e-mails are great when you just need to notify someone of something on the record, or for communicating with people outside of Salesforce.

Updating Fields with Workflow Rules

The last option I’m going to cover is updating fields. A workflow can be used to change the value of a field on the object that triggers it. Depending on the field that you’re changing, the value can either be predefined, or determined by a formula when the workflow executes. You can also clear out a field’s value this way. One thing to note, though, is that you can’t change the value in lookup fields this way; for that, you’d need an Apex trigger.

Now Go Build Cool Stuff with Workflow Rules!

So there you have it. Now that you know the basics of setting up workflows and configuring their actions, the best way to learn more is to go out and build for yourself. There are lost of common examples of things you can do with workflows; sending reminders for inactive Accounts, e-mailing sales managers when Opportunities go past a certain threshold, that sort of thing. But the real power comes from leveraging other parts of Salesforce’s functionality to get the most from your workflows.

One of my favorite examples was built by James Hemsley, back when he was my boss. Our company had a sales process that required specific pieces of information to be collected in a particular order. James created different record types for each stage of the opportunity, and different page layouts for each stage to show the data points you needed to collect for each. He then used a series of workflow rules to have the Opportunity’s record type (and thus the page layouts) update automatically as we collected data. Really cool stuff, and without a single line of Apex!

I hope these posts have helped get you up to speed on workflow rules. Do you have any questions, or an example of clever workflow to share? Feel free to post below, or to get in touch with Red Argyle via e-mail or Twitter @RedArgyleDotCom.

Red Argyle logo
Red Argyle logo

Related Blog Posts