Start tracking your progress
Trailhead Home
Trailhead Home

Determine the Order of Your Process Criteria

Learning Objectives

After completing this unit, you’ll be able to:
  • Configure what the process does after an action group is executed.
  • Describe the best practices for determining the order of your criteria nodes.
Important

Important

The examples described in this module include custom fields and email templates that don't exist in your Trailhead Playground. This module doesn't show you how to create those fields or templates, because our focus is on the concepts and best practices for migrating workflow rules. We recommend that you read along to understand the concepts, but don't try to follow the exercise steps in your playground. You apply your conceptual knowledge to complete the challenges at the end of each unit. Don't worry: you don't need to create any custom fields or email templates to complete any of the challenges.

Let’s Get Deterministic

Finally, the last step for converting your workflow rules: determining the order of the criteria nodes! When you think about the order of the criteria nodes, also consider what the end behavior should be. The end behavior can influence the order, or vice versa.

But before we jump into putting together a plan, let’s go over what to consider when planning the order of your criteria nodes.

Configure the End Behavior

Did you know that you can configure what happens after a process executes a group of actions? By clicking the last element in the row (by default, STOP), you can configure the end behavior for a criteria node.

Animation that shows the different end behaviors
Stop
When the criteria node evaluates to true, Salesforce executes the associated actions and then leaves the process. If the process includes remaining criteria nodes, Salesforce doesn’t evaluate them.
Evaluate Next Criteria
When the criteria node evaluates to true, Salesforce executes the associated actions and then evaluates the next criteria node in the process.
This option is available only when the action group doesn’t include scheduled actions and when there’s another criteria node to evaluate. The last criteria node in the process always uses the Stop option.
Note

Note

If a process evaluates the next criteria node, it’s evaluating the values that the record had at the beginning of the process. For example:

  1. A case is edited and its status is New.
  2. The process evaluates Criteria 1. The conditions are met, so Salesforce updates the case’s status to Escalated.
  3. The process evaluates Criteria 2 using the record values from step 1.

If you want a process to react to changes that occur in the process, select the advanced option in the object node.

Watch Out for Actions That Overwrite

Pay special attention to when multiple action groups update the same field. The last action group that executes wins.

Finalize the Order

Now let’s apply what we’ve learned about ordering to the case process criteria. Just like you did in the previous unit for actions, you create a game plan for the order of criteria in each process.

Order in the Top-Level Process

To review, the top-level process includes three criteria nodes.

Criteria Name Actions
Immediate Schedule Scheduled
Platinum Contract Case Closes n/a 7 Days After Closed Date Email Alert: Email a feedback request to the case contact
Escalation Keywords

Update Records: Set Priority to Service Affecting and Support Level to Tier 3

Quick Action: Set Target Resolution Date to TODAY()

n/a n/a
New Case Process: New Case, include reference to the case that started this process n/a n/a

Platinum Contract Case Closes includes scheduled actions, so its end behavior must be Stop. The other two criteria nodes aren’t mutually exclusive, so use Evaluate Next Criteria as the end behavior for both. To make sure that the process always evaluates both Escalation Keywords and New Case, place Platinum Contract Case Closes third.

Two of the criteria nodes update the same field: Target Resolution Date.

  • Escalation Keywords updates the field to today.
  • New Case updates the field to a month or two weeks from now, or today.

The action for Escalation Keywords should win, so let’s place that criteria node second. Since New Case evaluates the next criteria, Escalation Keywords is always evaluated.

Here’s the resulting order and end behavior for the top-level process.

Process “Case Management”
Order Criteria Node End Behavior
1 New Case Evaluate Next Criteria
2 Escalation Keywords Evaluate Next Criteria
3 Platinum Contract Case Closes Stop

Now let’s do the same for the invocable process.

Order in the Invocable Process

To review, the top-level process includes three criteria nodes.

Criteria Name Actions
Immediate Schedule Scheduled
Top Account Post to Chatter: Notify AE and manager about cases for large accounts

(Post to record, use email template from original email alerts for message, mention account owner and account owner’s manager.)

n/a n/a
Basic Support Update Records: Set Target Resolution Date to TODAY() + 30 n/a n/a
Premium Support Quick Action: Set Target Resolution Date to TODAY() n/a n/a
Standard Support Update Records: Set Target Resolution Date to TODAY() + 14 n/a n/a

Three of the criteria nodes evaluate the same field (Support Plan) and update the same field (Target Resolution Date). Once one of them executes, there’s no need to evaluate the others, so mark the end behavior for each as Stop. The order of the three Support Plan criteria nodes doesn’t really matter, but let’s order them according to increasing value of the Support Plan. So Basic is first, Standard is second, and Premium is third.

However, you want to make sure the other criteria node (Top Account) gets evaluated. If a case has a high-value account, the process should still determine that Target Resolution Date according to the support plan. So the end behavior for Top Account should be Evaluate Next Criteria. Place it first in the invocable process so that it’s always evaluated.

Here’s the resulting order and end behavior for the invocable process.

Invocable Process “New Cases”
Order Criteria Node End Behavior
1 Top Account Evaluate Next Criteria
2 Basic Support Stop
3 Standard Support Stop
4 Premium Support Stop

Take a Victory Lap

You’re done! So far, you’ve planned out every part of your new process: the object node, the criteria nodes, and the actions, order, and end behavior for each criteria node. In previous units, you implemented the plans for the object node, criteria nodes, and actions. All that’s left is to reorder the criteria nodes and configure the end behavior.

Implement the Final Order for the Process

Now that you’ve got a plan for the order of your criteria nodes, let’s update the processes. This part builds on the previous unit, so we recommend that you finish that first.

Our plan lists every criteria node, the final order, and the final end behavior.

Order in the Top-Level Process

First, let’s open up the top-level process and compare the existing order with the final order. The criteria nodes are currently in this order.

  1. Platinum Contract Case Closes
  2. Escalation Keywords
  3. New Case

Now compare that order with the final order.

Process “Case Management”
Order Criteria Node End Behavior
1 New Case Evaluate Next Criteria
2 Escalation Keywords Evaluate Next Criteria
3 Platinum Contract Case Closes Stop

In the plan, the criteria nodes are evaluated in the opposite order. Luckily, reordering criteria nodes is as easy as 1-2-3.

Reorder the Criteria Nodes

  1. Hover over New Case.
    Notice that blue box that appears around the criteria group and the Icon that indicates the criteria can be dragged icon in the right corner? That visual treatment indicates that you can drag the criteria group.
  2. Click anywhere inside that blue box and drag the New Case criteria group upward. A green line indicates where to place the criteria group.
  3. When the green line is between the object node and Platinum Contract Case Closes, drop the criteria group.
Reordering criteria using the drag-and-drop functionality in Process Builder

Repeat the same steps so that New Case is first, Escalation Keywords is second, and Platinum Contract Case Closes is third. In other words, rearrange the criteria nodes so that the order in your process matches your plan.

Configure the End Behavior

Now that the criteria nodes are in the final order, configure the end behavior. The default behavior is “Stop”, so you don’t need to configure the end behavior for Platinum Contract Case Closes.

For the other two criteria nodes:

  1. Click STOP.
  2. Select Evaluate the next criteria.
  3. Save the end behavior.

That’s a wrap for the top-level process. All the criteria nodes are in the final order, and when actions for the first two criteria nodes are executed, the process evaluates the next criteria.

Order in the Invocable Process

It’s the invocable process’ turn now. By opening the New Cases invocable process, we see the current order of its criteria nodes.

  • Top Account
  • Basic Support
  • Premium Support
  • Standard Support

Now compare that order to the final order.

Invocable Process “New Cases”
Order Criteria Node End Behavior
1 Top Account Evaluate Next Criteria
2 Basic Support Stop
3 Standard Support Stop
4 Premium Support Stop

The order is almost the same. You only need to switch the order of Premium Support and Standard Support. Similarly, the end behavior requires very little configuration. According to the plan, every criteria node except Top Account keeps the default “Stop” behavior.

But first, notice that the process’s status in the button bar is Read Only. In the Actions unit, you activated this process so that you could add it as an action to the Case Management process. To modify this process, clone a new version. You activate the new version later, so that the Case Management process uses the latest and greatest version.

  1. In the button bar, click Clone.
  2. Leave the default selections, and save the new version.
  3. Now that you can edit the process, drag Premium Support so that it’s the final criteria node.
  4. Change the end behavior for Top Account to Evaluate Next Criteria.
  5. To make sure that the top-level process uses this version of the New Cases process, click Activate.

Tie Up the Loose Ends

The end is in sight, we promise. All that’s left is a bit of cleanup. It’s time to make sure that the process is working correctly, but before you do that, activate the process and deactivate the workflow rules that you replaced.

Tip

Tip

Build and test your processes in a sandbox environment. That way, you can identify any issues without affecting your production data.

Deactivate the Replaced Workflow Rules

If you don’t deactivate the workflow rules before you test the process, both the process and workflow rules run. The result would be duplicates of each action. Let’s avoid that altogether and get the workflow rules out of the way.

Tip

Tip

Deactivate your workflow rules instead of deleting them. At least until you’ve fully tested that your process works as expected. Doing so prevents you finding out that the process didn’t quite work and having to rebulid the workflow rules from scratch.

  1. From Setup, enter Workflow in the Quick Find box, and click Workflow Rules.
  2. Next to each workflow rule that you replaced, click Deactivate.
  3. In the dialog that pops up, click OK.

Activate the Process

Now it’s safe to activate the top-level process.

  1. From Setup, enter Builder in the Quick Find box, click Process Builder, and open the Case Management process.
  2. In the button bar, click Activate.
  3. Click Confirm.

Test the Process

And finally, test the process. Draft up a list of permutations, and identify what you expect the result to be. Then try creating or editing records to trigger the process and see what happens. The longer your test plan, the better.

In drafting your test plan, consider:
  • When you expect actions to occur
  • When you expect actions to not occur (for example, when a record meets some but not all the filter conditions)
  • The result of a change meeting multiple criteria nodes
  • Permutations based on any formulas used

    For example: A formula in this process uses LOWER(), which changes all the text to lower-case. In the test plan, account for what happens if the subject contains different cases of a keyword: “password”, “PASSWORD”, “Password”, or “pAsSwOrD”.

Change Type Values Set Expected Result
Created Closed = True

Priority = High

Contract Type = Platinum

Waiting Interviews shows an interview scheduled to occur 7 days from now
Edited Subject contains “Urgent” Nothing
Created Subject contains “urgent”

Support Plan isn’t set

Priority = Service Affecting

Support Level = Tier 3

Target Resolution Date = today’s date

Created Contract Type = Basic

Subject = “LOST PASSWORD”

Priority = Service Affecting

Support Level = Tier 3

Target Resolution Date = today’s date

Edited Closed = true

Priority = Low

Subject doesn’t include escalation keywords

Description doesn’t include escalation keywords

Nothing
Created Top Account = true Chatter post created on case record that mentions the account owner and their manager
Created Top Account = true

Support Plan = Standard

Target Resolution Date = 2 weeks from today

Chatter post created on case record that mentions the account owner and their manager

Deploy the Changes to Production

At this point, you’ve analyzed workflow rules, planned out how to replace them with a process, and implemented that plan in another environment. And you’ve tested that it works correctly. It’s now time to move all those changes into production and call this project complete.

Earlier, to test the process without any duplicate evaluations and actions happening, you deactivated the workflow rules. Since you know that the process works, it’s safe to delete the workflow rules that the process replaced. Also consider deleting any workflow actions that are no longer being used by anything. For example, if the field update workflow actions aren’t referenced in other rules or approval processes, delete them.

Resources

Lightning bolt icon used to indicate that the content is for Lightning Experience

Remember, this module is meant for Lightning Experience. When you launch your hands-on org, switch to Lightning Experience to complete this challenge.

retargeting