In this video, we explore how to troubleshoot when a workflow rule doesn't fire.
And when a workflow rule does fire, but its actions aren't working as expected.
We're logged in as Aaron, the administrator of AW Computing, who recently participated
in a trade show that generated many new leads.
We want to mark new trade show leads as "Hot" to ensure that the sales team reaches out
to the leads while their interest is high.
From Setup, search for Workflow Rules.
We can see that Aaron has created a workflow rule on the Lead object called "Set Trade
Show Leads to HOT".
When a Lead Source field equals "Trade Show", the associated action sets the lead's Rating
field to "Hot".
However, Aaron soon discovers that the rule isn't firing on any leads that have "Trade
Show" as the lead source.
So what can we do to troubleshoot the problem?
Let's start with the basics by first checking whether the rule is active.
On the All Workflow Rules page, we can see that the rule is active, so that's not where
the issue lies.
To test the rule, we can create a new lead and set the Lead Source to "Trade Show".
Notice how the rating hasn't changed to "Hot"?
To investigate further, Aaron decides to use the debug log.
To enable logging, from Setup, search for Debug Logs, click New, and enter the username.
Next, we create another trade show lead to view it in the debug log.
Opening the most recent debug log, we can search for the rule name.
You can also search by workflow ID.
To locate the ID, open the workflow and copy the last part of the URL.
We can see that the rule criteria weren't met because a value of "False" was returned.
If we look more closely at the rule, we can see that "trade show" has an extra space.
That's what's causing the problem!
Removing the extra space from the picklist value should resolve the issue.
However, it always pays to test any updates you make to a workflow rule, so let's create
another trade show lead.
Again, the rating hasn't changed to "Hot".
Opening the latest debug log, we can see a returned value of "true" so we know that the
new record met the evaluation criteria and our workflow rule fired.
But although we resolved the first issue, we now have a new problem where the workflow
rule is firing, but it isn't producing the expected action.
Let's check whether other fields were updated, which might explain this behavior.
We can see that two updates were made to the lead's Rating field.
The first update set the value to "Hot".
The second update, which changed the value to "Warm", was caused by a different workflow
rule that fires whenever there are less than 50 employees.
A record can meet the criteria of both rules at the same time and both rules update the
Rating field, so there's no way to know whether the rating will be marked as "Hot" or as "Warm".
Because workflow rules can't be executed in a guaranteed order, avoid creating workflow
rules that update the same field on the same object.
To ensure that only one rule fires at a given time, Aaron adds new criteria to the second
rule to stop it from firing for trade show leads.
Aaron tests the rule one last time to confirm it's firing correctly and everything looks
in order.
Aaron now needs to investigate a workflow rule that should notify owners of Hot accounts
whenever an associated opportunity has an amount of $100,000 or more, and when the account's
Rating field equals "Hot".
The evaluation criteria are set to evaluate the rule when a record is created, and any
time it's edited to subsequently meet the criteria.
But some account owners haven't received an email notification when their records meet
the rule criteria.
To troubleshoot, let's create a record to test whether an email is sent.
You can also use email log files to investigate whether emails are sent correctly.
Under Setup, search for Email Log Files and click Request an Email Log.
The email arrives as expected so we know that the rule fired correctly.
The problem must lie elsewhere, so instead let's examine how the problem opportunities
are meeting the rule criteria.
First, we look for Workflow field update actions that might update the Amount or Rating fields.
Under Workflow & Approvals | Field Updates, there's a field update called "Add warranty
fee to Amount" that increases the entered amount on an opportunity by 3% when fired.
Notice how Re-evaluate Workflow Rules after Field Change isn't selected?
If a field update increases the Amount to over $100,000, the record will meet our notification
rule's criteria but it won't re-evaluate the rule.
Let's select that option now.
Next, let's examine the workflow rule more closely.
We can see that the workflow rule is associated with the Opportunity object.
As a result, any subsequent change made to the parent record -- Account, in this case
-- won't be evaluated after the opportunity is created.
In other words, if the account rating is changed to "Hot" after the opportunity is created,
the rule won't fire.
Avoid creating workflow rules on child objects that include criteria for a parent object.
If this type of workflow rule is essential, Apex code is required to fire the rule when
a parent record is updated to meet the rule criteria.
For more information, search for these topics in the Salesforce Help.
Thanks for using Salesforce!