Flow: How To Use “Assignment”

Assignment is the equal sign of flow (As you see in the icon). If you want to change the value of your variables, you will have to do it through Assignments.

flow assignment - setup

Some important notes before we dive into the details of Assignments:

1. Assignment Cannot Update Data Directly

If you have read my introduction of flow, you should know that Assignment is a logic element, so it does not have direct impact of your records. If you want to interact with your records, make sure you use a data element (Get, Create, Update, Delete).

2. Sometimes Assignment Can Be Skipped

Assignment is usually used for more complex operations (ex. in a loop or as a switch). If you simply want to change record fields, an Update Records element should be sufficient.

There are three main fields – Variable, Operator, and Value.

Assignment Fields

VariablePut in the variable that you want to change the value, whether it is an existing resource or you want to create a new one.
OperatorHow the variable will be modified by the value. The available operators are dependent on your variable type.
(See table below)
ValueCan be either an existing resource or manually typed in values.

Assignment Operators

OperatorExplanationAvailable Variable Type
EqualsEntirely rewrite the variable with the value you assigned.Text, Picklist, Number, Currency, Date, Date/Time, Collection
AddAdd numbers, add days, or add item to collections.
For text, the value will be appended at the end of the existing string. (Ex. AB+CD = ABCD)
Text, Picklist, Number, Currency, Date, Collection
SubstractSubstract numbers or days. Number, Currency, Date
Equals CountEquals Count = Equals + Count(Value), a count function included in the operator.

It counts how many items for only stages or collections.
(Ex. Col1 = [A, B, C], Count(Col1) = 3)
Collections Only:
Add at StartAs opposed to “Add” which add items at the end, “Add at Start” will add from the start of the collection.Collection
Remove All + [Value],
Remove First + [Value],
Remove After First + [Value],
Remove Before First + [Value]
Take these four as a group, and consider the whole formula semantic.
(Ex. Col2 = [D, E, F, G]
Remove After First “E” = Remove all the items after the first “E” in this collection. NewCol = [D, E])
Remove Position + [Number]Each item in a collection has their own position number (index), starting from 1.

(Ex. Col3 = [H, I, J,]
Remove Position 2 (I)
New Col = [H, J]
Remove Uncommon + [Collections]Compare two collections and only keep those items that exist in both collections.

(Ex. Col4 = [K, L, M, N]
Col5 = [K, N, O]
NewCol = [K, N])
There is a comprehensive article from Salesforce Help about each operator. Check this out!
Check Out How Assignment Can Be Used In Real Cases!
Use Case: Get a List of Names of Related Records to a Field
A while ago we published a Use Case to create ...
Read More
Use Case: Update All Related Contacts (Account Contact Relationship)
Do you have the Account Contact Relationship enabled for your ...
Read More
Use Case: Clone Any Objects with Related Lists with Flow
"Clone with related" is an amazing feature which sadly is ...
Read More
Use Case: Formula In Matching Rule With Before-Save Trigger
Have you one of the voters of this idea and ...
Read More
Use Case: Simple Loop Example in Flow
Earlier we have published the how-to-guides on Loop and Counter, ...
Read More
Use Case: Simple Counter Example in Flow
Earlier we have published the how-to guides on Loop and ...
Read More
Use Case: Mass Update Records From Related List #2
In this article we introduced the magical ids variable to ...
Read More
Use Case: Mass Update Records From Related List #1
Have you heard of inline editing? This is my favorite ...
Read More
Use Case: Create Custom Roll-Up Summary With Flow
I have really mixed feelings about the roll-up summary field ...
Read More
Use Case: Notify Owners When Case Merged Or Master Case Closed
I believe many are excited about the Case Merge release ...
Read More
Use Case: Clone Assets To Opportunity Products
I received this case to auto-create Opportunity Product or Quote ...
Read More
Use Case: Add Clone Button To Each Record In A Related List
If you migrated from Classic to Lightning, you must have ...
Read More
Use Case: Auto-Generate Multiple Lines Of Opportunity Product
* Updated at Mar. 25, 2021. The original flow is ...
Read More

Official Salesforce Help Article On Assignment

Notify of
Inline Feedbacks
View all comments