Posts

Showing posts with the label transform

Salesforce Fact #931 | Performing aggregation using transform element

Image
We can perform aggregation operations as well using the transform element in flow. For this, we need to create an apex class with the AuraEnabled variables to store the aggregated value and refer the same in the transform element. This avoids the need for using loop. In this example, we are getting the sum of number of employees across all the accounts. Attached are the screenshots. Reference:  https://help.salesforce.com/s/articleView?id=platform.flow_build_logic_transform_sum_or_count.htm&type=5

Salesforce Fact #924 | Updating multi select lookup using screen action

Image
Suppose we have a datatable and multiselect lookup in screen flow. Now, whatever records are selected in the datatable should get selected in the lookup component. For this, we can make use of screen action. We can create a subflow which would take the list of selected records and extract the ids using a transform element and return those to the main flow. The returned ids can be selected as the input of the lookup. This would work instantly. In this example, we have an account lookup which is updated with the selected records of the datatable. Attached are the screenshots.

Salesforce Fact #921 | Figuring out duplicate account names in screen flow

Image
Suppose we need to find out the duplicate account names in the screen flow. We can get that using collection filter, transform elements. In this example, we have taken two account type collection: DefaultAccCollection(which stores all the account records) and DuplicateAccCollection(which stores the account whose names are duplicate). And at the end, we can use a transform element to extract the names from collection. Attached are the screenshots.

Salesforce Fact #832 | Screen flow: using Transform element result in datatable

Image
In Screen flow, we can now use the Transform(Beta) element. We can use the result of the transform element in the standard screen flow datatable. In this example, we have fetched few account records and showing those records in the datatable after doing some manipulation. Couple of things to observe, 1) While trying to map in a sobject collection variable, the Id field is not available. 2) We have used BLANKVALUE() function on the account number, to show 'NOT AVAILABLE' when the account number is blank. 3) The TEXT() function is automatically added when mapping the picklist field values. It happened with the Industry and Rating fields. Attached are the screenshots.

Salesforce Fact #806 | Flow Transform(Beta) in action

Image
Suppose we need to show the account names in capitalized format after retrieving in screen flow. Now, no need to iterate over the list of accounts. We have the Transform(Beta) component which can take care of the formatting right when the mapping is done. Attached are the screenshots.

Salesforce Fact #805 | $EachItem in Transform element in flow

Image
So we have the Transform(Beta) element in the flow. Using this we transform the data from a record or collection and store it in another record or apex-defined variable. If we see the formula syntax, for collection type it uses the [$EachItem] merge field syntax for iterating over each item in the collection. In this example, we have a get records element which fetches the account records and this is used in the Transform element to get the account names. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_transform.htm&type=5 Attached is the screenshot.