📢 Attention Salesforce Certified Trailblazers! Maintain your credentials and link your Trailhead and Webassessor accounts by December 6th. Learn more.
Start tracking your progress
Trailhead Home
Trailhead Home

Work with Flow

Learning Objectives

After completing this unit, you’ll be able to:

  • Demonstrate your knowledge of the new assignment operators for flow.
  • Maintain your Salesforce Certified Platform App Builder certification.

In this unit, we focus on just one new feature, new assignment operators in flow for updating active stages and collections. Let’s get to it.

New Assignment Operators

What’s new?

There are now several new assignment operators that make it easier to manipulate collection variables and the $Flow.ActiveStages system variable. 

How does it work?

Now you can easily remove specified items and truncate collections and active stages. You can count the number of collection items or active stages and store that number in a variable. You can add items to the beginning instead of only the end. And you no longer need Apex code or loops to perform these operations on collections.

For example, to clear all active stages with an Assignment element, select the remove all operator, and enter the $Flow.ActiveStages system variable in both the Variable and Value columns. Assignment screen showing the $Flow.ActiveStages system variable in the Variable and Value fields with a remove all Operator.

Here are the new assignment operators.

Operator Update Description
add at start
collection variables
Adds items or stages to the beginning of the collection or active stages.
equals count
number variables
Counts the number of active stages or items in a collection, and assigns that number to a variable.
remove after first
collection variables
Removes all items or stages after the first instance of a specified value.
remove all
collection variables
Removes all instances of a specified value.
remove before first
collection variables
Removes all items or stages before the first instance of a specified value.
remove first
collection variables
Removes the first instance of a specified value.
remove position
collection variables
Removes the item or stage at a specified position. For example, if a collection variable contains three items—Red, Green, Blue—and the assignment removes position 2, Green is removed.
remove uncommon
collection variables
Compares two collections, and removes all items that aren’t common to both collections.

Also, the add operator can now append collections to collection variables of the same data type or object type. However, you can set such assignments only from Metadata API. From Cloud Flow Designer, you can’t save an Assignment element that contains a collection variable in the Value column for the add operator.