cancel
Showing results for 
Search instead for 
Did you mean: 

Any tips on getting the content of a Collection into the body of an email?

JeremyRTDean
Level 5

I attach an Excel spreadsheet to my process completion output reports which has the details of the run taken from the queue.  The Excel spreadsheet is created by pulling Queue data into a Collection and then writing it to Excel.  It could have any number of rows, depending on what was in the queue.

My users have asked if the content of this report could be included in the body of the email rather than as an attachment.

Queue item 1 - Completed

Queue item 2 - Completed

Queue item 3 - Exception, invalid input

Queue item 4 - Completed

Queue item ... etc.

I can't see any obvious (or even non-obvious) ways to do this.  Any ideas?



------------------------------
Jeremy Dean
------------------------------
1 BEST ANSWER

Helpful Answers

RenzDelaCruz
Level 3

Hi Jeremy, 

Firstly,

Set up a data item that initializes the table. Assuming this is called "[Message]" For example, 
<table border='1' cellpadding='3' cellspacing='0' style='width:600px'>
  <tr>
    <th>Queue Item</th>
    <th>Status</th>
  </tr>
This sets up the appearance and headers of your table.

Create a logic that captures the completed and exception items in your Work Queue. Loop through the items to create a Work Queue Collection Report. Let's say this collection report is called "[Report]".

Create another loop that collects the information from [Report] collection to create a table for your email message. Your example calculation stage in the loop shall look like this.

[Message]&"<tr>"
    &"<td>"&[Report.Key]&"</td>"
    &"<td>"&[Report.Status]&"</td>"
</tr>"
This adds a row to your table and closes that row as well.

Finally, after the end of the loop. You will close your table using another calculation stage. 

[Message]&"</table>"

Regards,
Renz



------------------------------
Renz Carlo Dela Cruz
------------------------------

View answer in original post

2 REPLIES 2

RenzDelaCruz
Level 3

Hi Jeremy, 

Firstly,

Set up a data item that initializes the table. Assuming this is called "[Message]" For example, 
<table border='1' cellpadding='3' cellspacing='0' style='width:600px'>
  <tr>
    <th>Queue Item</th>
    <th>Status</th>
  </tr>
This sets up the appearance and headers of your table.

Create a logic that captures the completed and exception items in your Work Queue. Loop through the items to create a Work Queue Collection Report. Let's say this collection report is called "[Report]".

Create another loop that collects the information from [Report] collection to create a table for your email message. Your example calculation stage in the loop shall look like this.

[Message]&"<tr>"
    &"<td>"&[Report.Key]&"</td>"
    &"<td>"&[Report.Status]&"</td>"
</tr>"
This adds a row to your table and closes that row as well.

Finally, after the end of the loop. You will close your table using another calculation stage. 

[Message]&"</table>"

Regards,
Renz



------------------------------
Renz Carlo Dela Cruz
------------------------------

Hello.

I normally use it in the following way:

17223.png


Get Report: Gets report and includes it in a collection.

Start Report: Creates the Header and loads CSS information that will be used.

<!DOCTYPE html>
<html lang='pt-br'>
  <head>
    <meta charset='UTF-8' />
    <meta name='viewport' content='width=device-width, initial-scale=1.0' />
    <meta http-equiv='Content-Type' content='text/html charset=UTF-8' />
    <style>
      #reportExemple {
        font-weight: bolder;
      }

    </style>
  </head>
  <body>
    <div id='reportExemple'></div>

Get current rows: Checks if items exist.
Decision: If there are no items, send a personalized report "no items to process
Loop: For each for each line in the collection
Insert item: Loads a new item into the body by concatenating Header + body
Data Item Body: [Report] = [Report]& [Item]
End Report: Closes the report tag, concatenating the result

  </body>
</html>

  • You can have a replace structure in a data item base for example, customization is at your discretion.

Regards,



------------------------------
Leonardo Soares
RPA Developer Tech Leader
Bridge Consulting
América/Brazil
------------------------------

Leonardo Soares RPA Developer América/Brazil