How to add dynamic table to mail

Hello,

I want to add a table with a specific column but dynamic number of rows to a mail. (i.e.) A table should be added in a mail. The table has fixed number of columns but the number of rows differs based on number of input data.

Example:
In the first execution, the BOT process three data, then the below table must be added to mail.

In the second execution, BOT process five data, then the mail should have below table.

Can any one help me with this please.?

Thank you.

Hi @shahidh.aqeel.shahul,

Is the data being processed from queues or data table directly?

You can use data table to store the data that is being processed.

And while drafting email, just add the contents of that data table , it will automatically populate whatever is there in the data table (3 or 5 or whatever number of rows).

Regards
Sonali

Hi @shahidh.aqeel.shahul

You can use the [Activities - Create HTML Content] (Activities - Create HTML Content) Activity to pass the datatable to your mail body

For ref- Need help in formatting mail body,Can anyone help me please - #2 by AJ_Ask

Hope this helps :slight_smile:

1 Like

Hello @sonaliaggarwal47

Thanks for your response. In this case, Iā€™m having the data in a data table. I have to incorporate this data inside the mail content as shown in the below example.

The content of the mail like which is above and below the table needs to be taken from config to avoid hard coding. With in the text from config, I need to incorporate the data table. Can you please help if this is possible.

Thank you.

Hello @AJ_Ask

Thank you for the response. In the HTML content, I need to incorporate the table with in a text which is taken from the config. Can you please help if this is possible?

Please find the example below.

Thanks again.

Hi @shahidh.aqeel.shahul

Did you give it try for the activity.? For text from config you can pass the config variable also in the the activity. Which will get the text & add another variable for data table.

1 Like

@shahidh.aqeel.shahul,

Please watch this video.

1 Like

hello
try to use assign activity and append the html code for each row and out of the loop use that variable inside the mail activity

html=html+ā€œā€+your variable+ā€œā€
use like these

  1. Output DataTable Activity: Input: dt Output: plainText
  2. Send Email Activity: Set Body: "Here is the DataTable content:\n" & plainText
    Set IsBodyHtml: False

I am not sure whether there is any direct method to include data table to a mail body

I used to create an html table content as a first step and loop through the data table to create rows. This will give us dynamic table content

In the email body - replace the table place holder with the created HTML content and send the email. This will work.

1 Like