Let’s say you need to determine the number of unique accounts across a series of opportunities.

The old school method of doing this in a flow is using nested loops. Nested means you loop within a loop. You do this because you don’t want to have a Get operation instead of a loop.

The steps in the flow look like

  1. Get the specific opportunities
  2. Get all accounts (hopefully with some criteria to avoid getting literally all accounts)
  3. Loop through all opportunities
  4. Loop through all accounts
  5. Have a decision to determine whether current account is for the current opportunity and not already in a collection called UniqueAccounts
  6. If the above is true, add the current account to UniqueAccounts

Enter the transform element. With this new-ish functionality, you can skip the nested loops and map directly from opportunities to accounts.

The resulting steps in the flows are

  1. Get the specific opportunities
  2. Transform from opportunities to accounts, matching on AccountId
  3. Loop through the resulting accounts
  4. Have a decision to determine whether the current account is not already in a collection called UniqueAccounts
  5. If the above is true, add the current account to UniqueAccounts

See the benefit?

The takeaway
Using a transform element saves time, reduces technical complexity and is also fun to use.

Category:
Salesforce