It’s easy to make a table of multiple records in a process for your emails. In this article I will show you how to make a table with a process by looping and using HTML. You can check out my other article about looping for a reference here. This article’s example we will be creating a list of accounts where the type equals “partner” and we’ll list their name and phone number. The photo down below is what the finished process will look like.
The basic idea is we will do the following in our process:
- Flag the records we want to include in our table
- Loop through the flagged records
- In each time we loop we will create a row for our HTML table (using tr and td tags) and store it in a process parameter
- Then after the loop, we will add the the before and after table tags, then add it to an email.
First step for the process is to create an unlimited text parameter. You’ll use this to create your list.
Now you want to flag all of your records that match your conditions and then read all of the flagged records, in our case we will flag all of the accounts where type is partner.
Now we will loop through our records. Each account it’ll loop through it’ll grab the name and the phone number of the account and put it in our formula. In this formula we’re building a table row, notice the HTML <tr> and <td> tags in the formula. Also notice how each time we take the current value in the process parameter and append the next row to it (this is important or after the loop we’ll only have the last row created)
Now that the loop is done, we need to add the final touches to the HTML table by adding the <table> and </table> tags around the rows we created in the process parameter, we’ll add a border and padding to the table tag to make it look nice. We will also add here the table column headers (the Account and Primary phone # values so you know what the columns are for)
This is the end results this is how the table will look like in the email. All we need to do to add this to the email is drop the process parameter we created into the body of the email.
That is all there is to it. We can include any other valid HTML in our table as well, like if we wanted to make the account names a hyperlink to the record in Creatio.