Red Argyle Logo

Patterns
The Salesforce Blog with Tailored Goodness

What is a Salesforce Workflow Rule?

Workflow RuleI’d like to say that I’m a very procedural person. Mostly, I’m just a very easily distracted and attention-deficit person. I do things in patterns and sequences because it helps me to remember to get them done consistently. Yes, my morning routine may be set in stone, but I very rarely forget to take my vitamins (which I do right after brushing my teeth).

Businesses have routines like this too. When action A occurs, action B should also occur. Performing these reactions manually can be time-consuming, error-prone, and in some cases downright mind-numbing. Thankfully, Salesforce gives you lots of options to help with situations like this. Workflow rules are Salesforce’s first line of automation, and learning how to use them appropriately can save you time, money, and a few bottles of ibuprofen.

Workflow Rule Basics

Workflow rules  allow you to configure Salesforce to take certain actions based on certain data conditions. More simply put, workflows are how you tell Salesforce to do things for you. They’re triggered when you create or edit a record, according to criteria that you set. Once triggered, they can perform actions immediately, or on a time-delayed fashion.

There are four types of actions that a workflow rule can perform:

  • Creating Tasks – Assign tasks to a user, role, or record owner
  • Sending e-mails – Send an email alert to one or more recipients
  • Field Updates – Updating the data in an object’s fields
  • Outbound API messages – Send secure & configureable API messages

I haven’t worked with the outbound message functionality, so we’re going to skip that one and focus on the other three; you’re more likely to see them on a day-to-day basis.

How to Set Up a Workflow Rule

How to Create  a Workflow RuleWorkflows are created in the Setup menu by going to Create > Workflow and Approvals > Workflow Rules. When you create a workflow rule, you start by picking the object that you want the system to monitor for changes. You then decide the set of circumstances that will trigger the workflow. There are two factors that go into when a workflow fires: the evaluation criteria, and the rule criteria. The rule criteria is where you define which data points have to be present on the record for the workflow to fire off; for example, you might want the rule to only fire when an Opportunity’s Total Amount is over $500,000, or when a new Lead is created with an address in Texas. You can set up the rule criteria either by choosing from drop-down lists, as you do when creating a new report, or by entering a formula that must evaluate to “true”.

The evaluation criteria

The evaluation criteria decide how often Salesforce will check to trigger the workflow (assuming the rule criteria check out). You get three options here. If you choose to evaluate when the record is:

  • “Created” –  Salesforce will only check when a new record is entered into the system
  • “Created, and every time it’s edited” – Salesforce checks every time you make or update to a record
  • “Created, and every time it’s edited to subsequently meet criteria” – Salesforce will only send notifications if something is created as meeting the criteria, or moves from a state of not meeting the rule criteria to a state where it does.

That last point, I think could use a little explaining; it’s tripped me up before. Let’s go with my earlier example of a workflow rule that activates when an Opportunity’s Total Amount goes over $500,000. If you choose the third option, then Salesforce will only trigger the workflow when the Opportunity’s Total Amount goes from under $500k to over $500k; that is, only when the record is changed to meet the criteria. Any other change you make to the record won’t trigger the workflow, unless you drop the value back below $500k, and then back over $500k, at which point it would fire again.

If you choose the second option, though, then the rule will fire every time you edit the Opportunity, as long as the rule criteria are still met. So it’ll fire the first time the record goes over $500k. Then if you go in and change the Opportunity’s Stage, the rule will fire again, because the value is still over $500k. Knowing the difference between these two options is useful for making sure you’re getting the automation that you actually need.

So there’s a basic overview of what workflows are, and how to start configuring them. In the weeks to come I’ll have a follow-up post that explores in more detail the sorts of actions you can perform with workflow rules, as well as some useful workflows I’ve used in the past, and some of the limitations of workflow. Got any questions about improving the automation in your Salesforce org? Feel free to get in touch with Red Argyle or post in the comments below.