There were many questions from readers about the flow transform element. So I played around with it a little bit further and discovered some unpleasant surprises. It’s still helpful, just less helpful than expected.
The core of the issue is, when you use the transform from source data to target data, it’s not actually getting all the fields of the target object. It only gets the field you’ve mapped to.
Let’s say you want to get information from all the account’s associated with some opportunities. We’ll use this picture as a visual.
Step 1 in the flow gets Opportunities with certain conditions.
Step 2 transforms from Opportunities to Accounts. This is done by mapping Opportunity.AccountId to Account.Id.
The key is that the transformed data is an Account collection, but the only field populated in the collection is the Id. If you want the account names, you need to use a Get Records step. But you cannot just get records using the transformed account data because it’s technically a record collection, not a text collection (and you cannot get records using a record collection).
So in Step 4, you need to loop through the transformed Accounts, and add the Ids to a text collection.
In Step 5, you can get Accounts that are in the text collection using the “In” operator.
FYI, in Steps 3 and 6, the Account.Id and Account.Name are displayed in a data table. In Step 3, only Id is populated, while Name is blank. In Step 6, both Id and Name are set.
The takeaway
While you can use the transform step to simply loops, it doesn’t prevent them altogether.
Note: I normally don’t write such technical emails. Since the transform step is an interesting new feature in Salesforce and people asked me about it, I covered it in this email. Let me know if you like these types of emails, or whether you prefer higher-level concepts.