Display the Related Records as HTML using Flow #inSalesforce
Suppose create a list of Contacts under an Account
Create a field on Account object - rich text field Contact List (131072)
Create a flow
Auto-launched flow -
Create resource - variable - recordId, datatype - text, available for input
GET:
getContacts (to create list)
Contact object, criteria : AccountId equals recordId,
All Rceords, All Fields
Loop:
go through each Contacts Indivisually
LoopThrough
Collection Variable :getContacts
Assignment:
Add HTML Row to Table
Create resource - variable - contactTable, text, default -
<table><tr><th>FirstName</th><th>LastName</th></tr> ~ first line of table
Operator: Add
Create resource - text template - tableRow,
<tr><td>currentitemfromloop.firstname</td><td>currentitemfromloop.firstname</td></tr>
finally, Assignment:
CloseList
ContactTable Add </table>
Update:
Update Account
Account Object, Criteria: Id equals recordId
Contact_List__c(custom field on Account) equals ContactTable
Connect well, Save, Debug and Activate
Insert the above in Email Template or wherever you want to be displayed like lightning page:
Create new - Fill up the necessary details, In HTML Section - Merge Field Contact_List__c and Save
Test Creating an Email and inserting the template
The above can be triggered from Screen flow, Record Triggered flow, Scheduled Flow, Button
Visual: https://www.youtube.com/watch?v=dkvU992334I
Comments
Post a Comment