Emailing a list of records

Emailing a list of records

In my application, users can submit payments - multiple payments at once actually. 

In my action I just turned this list of payments into a record list and that worked fine.

I now, however, must send an email recipt of these transactions to the user and have hit a snag.

While recordlist is an option for input on webscreens and webblocks, it is not an option as an input for emails. I potentially have more than 1 record that the user has created in the payment and need to display all of these in 1 email.

How can I input a list of record IDs into an email screen?

A few alternatives I've explored and rejected:
Doing an aggregate in the email that pulls the past 60 seconds of payments created by this user and displaying that. (This won't work though because they may submit the page as many times in 60 seconds as they want which could result in the same data showing up on two emails, leading to confusion.)
Creating a series of inputs that are hidden or not run unless that input is not null (The if statements for this would get VERY messy very quickly, and still only has a finite amount of inputs.)
Sending an email for each line item the user has created a payment for. (This could result in many emails to one user for a single form submission.)

As the payments are already the parent record of paymentdetails (where it's split into individual line item charges and credits.) It would be redundant and pointless to make a parent parent payment table just to make this email work.

Does anyone have any other ideas of how to get a specific list of records into an email without a parent record ID?

Braxton Bragg
Braxton --  
I presume you have to create a workflow which can populate every minute or desired time store in a array and send the value to a template 

you might have to include these values / variables inside your email template and send it across  more like a cron

1. Have a string input parameter to the email.
2. Concatenate the payment IDs into a string, separated by a comma or some other delimiter.
3. Pass that into the email.
4. In the Email Preparation, split the string by the delimiter (String_Split in the Text extension).
5. ForEach over the results of String_Split, doing a query to the DB (convert back to the ID for the query using IntegerToEntityRefInteger(TextToInteger(String_Split.Result.Current.Value))) as the filter value in your query).

This is a fairly ugly pattern, though... I'd suggest having a parent record. If the transactions are "related enough" to send 1 email, you can formally related them via a parent record.

Decided to go with a simple unique "EmailID" assigned to each batch, and running an aggregate based on the input of that key for the batch.

Thanks for the input though guys!