How to create a Email Template with tokens

I could create an email template and it works. But now i want to create email template with placeholders which i can replace while sending email, is there a link which gives step by step how to achieve this.    
1 answers

Hi Abhinav,

So you probably already downloaded all necesairly modules since you need this for being able to run the email template modules.

So the first thing you start is to define an object which you want to pass to use to replace tokens. So let's say in this case it's called MailData with 2 attributes. So I start with running the model reflection so I can use this token in my email template. Herefor you have to add the page MxObjects_Overview in from the _USE_ME folder from the MxModelReflection Module.

Then In selecting my token object the MailData entity is available. Now i can define my 2 members Name and Signature:

and define the message in your email template.

Now in the microflow I can create an object of the MailData and fill it with the required values. In my case I just fill it with fixed values but you can use data which you want off course.

So Now you had sending a simple mail working, So I guess you know already how to retrieve your emailtemplate. So I skip this, now when have your email template you also have to retrieve the list of tokens. Then you create your email object, fill the values and also the body from the email template. Do this before running the replace tokens action because the body is necessary for the replace token action. Then finally you can call the replace tokens action and you have a very simple version of the email templates with tokens working:

Normally we use error handling when using a java action to prevent your normal logic from failing due to unexpected errors in the add on modules.

Hope this helps.



Here a model share of the microflow. I only filled the body object in the email template but other items should be configured as well off coursel.