Real-World Examples of Salesforce Workflow Rules (Workflow Deep Dive, Pt. II)

Written by | May 26, 2016

Whether you came from Pt. I (The Elements of a Salesforce Workflow Rule (Workflow Deep Dive, Pt. I)) or you found this for the examples only, welcome. This is the second installment of a two-part blog series that takes a closer look at workflow functionality in Salesforce. In this post, I’ve provided a few real-world examples to help you on your declarative development journey. Enjoy!

Scenario 1: Lead Assessment (Marketing Cloud)

Description

Your organization sells consulting services and manages its business through Salesforce.com. Some of your Leads come in from the Web. Since Web Leads are manually qualified before they are created, they do not initially have a Rating value. However, you would like to automatically set the Rating on certain Leads that come in through the Web; specifically, you would like to identify Web Leads that communicate a near-future project start.

Custom Fields Needed

Projected Project Start (Picklist)

Picklist Values: 0-1 Month, 1-3 Months, 3-6 Months, 6-12 Months, 12-24 Months, 24+ Months

You create this field to convey the likely timing of the need for consulting services.

Evaluation Criteria

Evaluate the rule when a record is: Created

Rule Criteria

Run this rule if the following criteria are met:

  • Lead: Lead Source equals Web
  • Lead: Projected Project Start equals 0-1 Month

Immediate Workflow Actions

Field Update: Update Rating

  • Object: Lead
  • Field to Update: Lead: Rating
  • New Field Value: Hot

Time-Dependent Workflow Actions

None

Summary

You just created a Workflow Rule that looks for any Web-sourced Leads that communicate a desire to engage your consulting services in the next few weeks. If a Lead meets the specified criteria, it automatically increases the Rating to “Hot”; this will allow Users to see this new Lead via a List View of open Leads with a rating of “Hot” and take action quickly.

Scenario 2: Opportunity Probability (Sales Cloud)

Description

You have configured your Sales process and set an appropriate Probability percentage for each corresponding Opportunity Stage. However, you feel that some sales situations warrant a higher Probability than what you have configured. One scenario in particular is an open Opportunity associated with an Account within a certain industry (Government) with whom an Opportunity has closed in the past year. These variables point to a higher probability of closure. As a result, you set up a custom field to track your “True Probability” and update it based on a Workflow Rule.

NOTE This example involves multiple objects, so read carefully. Both Workflow Rules are based on the Opportunity object. The first Workflow Rule updates the parent Account object and the second Rule includes the Account object in the Rule Criteria.

 

2.1: Workflow Rule to Update Custom Date Field on Account

 

Custom Fields Needed

Last Won Opportunity Date (Date)

You create this field to capture the date of the most recent Closed/Won Opportunity. NOTE: This custom field should be on the Account object, not the Opportunity object.

Evaluation Criteria

Evaluate the rule when a record is: Created, and any time it’s edited to subsequently meet criteria

Rule Criteria

Run this rule if the following criteria are met:

  • Opportunity: Wonequals true

Immediate Workflow Actions

Field Update: Update Last Won Opportunity Date

  • Object: Opportunity
  • Field to Update: Account: Last Won Opportunity Date
  • Use a formula to set the new value: CloseDate

Time-Dependent Workflow Actions

None

2.2: Workflow Rule to Update True Probability on Opportunity

 

Custom Fields Needed

True Probability (Percent)

You create this field to convey a more accurate Probability of the Opportunity (without overwriting or removing the standard “Probability” field.

Evaluation Criteria

Evaluate the rule when a record is: Created, and any time it’s edited

Rule Criteria

Run this rule if the following formula evaluates to true:

AND(

ISPICKVAL(Account.Industry, “Government”),

Amount > 1000,

TODAY() –  Account.Last_Won_Opportunity_Date__c < 365

)

Immediate Workflow Actions

Field Update: Update Last Won Opportunity Date

  • Object: Opportunity
  • Field to Update: Opportunity: True Probability
  • Use a formula to set the new value: MAX(0.9, Probability *1.2)

NOTE In this scenario, assume that you don’t want the Probability of an open Opportunity to exceed 90%, so you cap it accordingly. You can achieve this limit by utilizing the MAX() function in your Workflow Action.

Time-Dependent Workflow Actions

None

Scenario 3: Case Escalation (Service Cloud)

Description

Your customers do not always accurately communicate the real reason for submitting a Case and, unfortunately, your organization has had an issue with certain urgent Cases slipping through the cracks as a result. You have noticed a correlation between the presence of a few certain keywords in the Description field and requests for subscription cancellations. To address the issue, you want to escalate Cases with any of those particular keywords in the Description field. Additionally, you want to provide a custom visual indicator to appear on the Case Detail page that will show a different image for Open/Non-Escalated, Open/Escalated, and Closed Cases. Additionally, if the Case is still open, you want an email to be sent out two hours after the Case is created as a follow-up to make sure that the Case is closed promptly.

Custom Fields Needed

Health Status Indicator (Formula):

IF(

IsClosed,

IMAGE(“img/msg_icons/confirm32.png”, “Closed”),

IF(

IsEscalated,

IMAGE(“/img/msg_icons/error32.png”, “Escalated”),

IMAGE(“/img/msg_icons/warning32.png”, “Open”)

)

)

This formula will display a visual indicator to represent Case status.

Figure 4-27. Your Health Status Indicator field

Figure 4-27. Your Health Status Indicator field

NOTE You may notice that the images in your formula are not external. These are actually from a little-known library of built-in icon images that you can use. However, these images are not guaranteed to always be around, so keep that in mind.

Evaluation Criteria

Evaluate the rule when a record is: Created, and any time it’s edited to subsequently meet criteria

Rule Criteria

Run this rule if the following criteria are met:

  • Case: Description contains cancel,quit,sue,refund
  • Case: Closed equals false

 

Immediate Workflow Actions

Field Update: Update Escalated

  • Object: Case
  • Field to Update: Case: Escalated
  • Set to: True

Time Triggers

2 Hours After Rule Trigger Date

Time-Dependent Workflow Actions

Email Alert: Alert Escalations Team

  • Email Template: Potential Cancellation Case
  • Recipients: Director, Customer Service AND Escalations Queue

Both parts of this blog post series are excerpts from my book, Practical Salesforce.com Development Without Code. I hope you found it informative and useful!

Salesforce MVP | Author of Practical ..read more