EmailTemplate - choose the right template

0
Hi Mendix community   I’m struggling with the EmailTemplate module and can’t find the right solution on the forum. Steps I did: Enabled EmailTemplate, Encryption and MxModelReflection Copied administration snippet in my module and configurated → works Created a new template in administration while running my app. (Name: Template test) Copied the sub_SendSimpleEmail in my module Called that microflow in another microflow and now I need to fill in the parameters. See screenshot   My question. What do I have to fill in in the EmailTemplate (type) as argument for the right template (Template test)? I hope my question is clear. Thank you in advance!
asked
5 answers
1

You need to retrieve the email template from database, then set it as Argument. If you retrieve the email template by name, please note that the logic will break when the template’s name is changed.

answered
0

Thanks Thorsten for your help. I’m one step closer thanks to you. Already a new error now but I’ll first try to figure out myself.
Is there any workaround for your note, if the template’s name is changed?

answered
0

Hi Mike,

personally, I like to create an association between a configuration object and an emailtemplate. This way you’re sure that when the name of the template changes, it can still be retrieved.

answered
0

Hey Roy, thanks!

At this moment I’ve a working flow for the email template but indeed, it would be better with an association. Still figuring this out!

answered
0

Hi Mike

 

To add onto possible solutions which might help you. I did the following:

When the user wants to send a mail, he clicks on a button that opens a page with all templates listed (in a listsview for example), which looks like this:

 

Then the user can pick a template, with the green check symbol button. This button calls the sendMail microflow and passes the template as a EmailTemplate object to the microflow. The EmailTemplate parameter should then be the template you chose. You don’t need to retrieve the template by name then.

 

I think this is a fairly elegant way to make the send mail action flexible, as you don’t have to retrieve the template by name now.

 

I hope my answer could help you a bit or any other user reading this.

 

Lenny

answered