Email tokens - multiple lines

0
Hi All, I'm using the email module successfully to send emails, and have got my head around tokens and reflection. However, ideally I wish to be able to iterate over a list to generate multiple lines in an email. For example, at the moment I can do "{%Name%} is in your class" to generate a single line in an email. What I would like to do, is to iterate over my "Person" object, and have: "{%Name%} is in your class" - many times, so the email looks a little like: Peter is in your class John is in your class Michael is in your class ...all contained within one email. Caveats are that I don't know how many "People" would be in the class at design time - could be 1 could be 100. Do I have to create a document and use attachments, or is there a neat, inline way of doing it? Many thanks Tarique
asked
2 answers
2

Tarique,

As Chris said, what you want to accomplish is not possible with a token.  I just had to do this in one of my projects and my approach was as follows:

- On the email template, I added a boolean attribute entitled AddStudentListToEmail

- In the microflow that generates the email, I check that boolean attribute, if its true, I

- Modify the email body via a loop, adding one line to the email for each student

Note that this modification can take place either before or after token replacement.  Also, I believe I needed to add an html break code after each line so that each student would be on a different line.

Hope that helps,

Mike

answered
1

That is not possible in a direct way with a token that represents a list, but you can fill a text attribute in a microflow (e.g. 'Peter, John and Michaeal are in your class')  and pass that as a single token.

 

answered