Flow, Resources

Why Are Assignments So Confusing?

I noticed this about a year ago: The assignment element is confusing for most people.

I decided to expand my content to include more detail on the assignment element.

Read until the end to find the link to the infographic on assignments that you can download and keep.

What do they do? ⛖

The assignment element performs mathematical operations and moves data between variables.

What they don’t do 🛑

They don’t evaluate criteria to produce true/false outcomes.

Assignments run from the right side to the left side.Variable1 Add 1 will add 1 to the Variable1 value.Variable1 Equals Variable2 moves Variable2 value to the Variable1.

Popular operators 

  • Equals
  • Add
  • Subtract
  • Add Item (Multiselect Picklist)

Popular Collection Operations 🟰

  • Equals Count
  • Remove Uncommon
  • Remove After First (Text Collections)
  • Add At Start (Text Collections)

Pro Tips ✖

Use two consecutive assignment elements when you need one assignment to execute after another.

Build formula resources for complex statements.

Functions cannot be used directly. Instead, create a formula resource including functions.

Example Use Cases ➗

Counters: Create a number variable with no decimals, and add 1 in each loop iteration.

Blank text variables with an empty right box.

Assign error messages to a variable in the display text component for variable visibility.

Add 1/24 to date-time variables to add an hour.

Use the Equals Count operator to get the count of records in a record variable.➡️

Now head over to https://SalesforceBreak.com to download your infographic. Click on the last menu item on the main page. ➡️

This post was originally made to LinkedIn on January 8th, 2023.

Read the previous post: Hidden Gem in Spring 23: Schedule-Triggered Flow Improvements


Assignment or Update

Hello folks,

I have a quick but important update for you this week.

An issue I see quite frequently happens when folks try and remember to use the assignment element instead of the update element in record-triggered flows. You can indeed use an assignment element instead of an update element in a before-flow to change the field values on the record that triggered the flow. However, this is not true when running your record-triggered flow in after-save mode.

To avoid confusion and facilitate an easy transition between before-save and after-save, always use the update element in a record-triggered flow to update the field values on the record that triggered the flow.

I am sure you know by now; before-save is labeled as Fast Field Updates, and after-save is labeled as Actions and Related Records in the record-triggered flow start element configurator.

If you have any questions, please do not hesitate to ask them on the Salesforce Break Slack. The invitation link is on https://SalesforceBreak.com.

Content and event updates:


P.S. Originally published on 04/05/2022.

Read the previous issue of the newsletter here.

Read the next issue of the newsletter here.

Subscribe to the weekly educational Salesforce Flow Tips newsletter here.