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.
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.
|Variable||Put in the variable that you want to change the value, whether it is an existing resource or you want to create a new one.|
|Operator||How the variable will be modified by the value. The available operators are dependent on your variable type. |
(See table below)
|Value||Can be either an existing resource or manually typed in values.|
|Operator||Explanation||Available Variable Type|
|Equals||Entirely rewrite the variable with the value you assigned.||Text, Picklist, Number, Currency, Date, Date/Time, Collection|
|Add||Add 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|
|Substract||Substract numbers or days.||Number, Currency, Date|
|Equals Count||Equals 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)
|Add at Start||As 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])
Check Out How Assignment Can Be Used In Real Cases!