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: An Easy Flow To Copy Address Field
This is just an easy example to illustrate the concept ...
Read More
Use Case: Mark A File Upload as Required in Flow
Have you tried the File Upload component in Screen Flow ...
Read More
Use Case: Create Parent and Child Cases in One Flow
Do you need to create a Screen flow that allows ...
Read More
Use Case: Replace “New” Button with Screen Flow
Currently we can only overwrite the New button using programmatic ...
Read More

Official Salesforce Help Article On Assignment

Notify of
Inline Feedbacks
View all comments