How to make email sending microflow to work for multiple templates?
0
I am using Email module with templates and it is running successfully. I am using the following flow: The above screenshot uses ‘EmailInfo’ which is passed as parameter , to extract token for a template. Now the scenario is , I have multiple templates and I want to use the same microflow for all templates. But the current microflow accepts only object of type EmailInfo which has only one string field. My requirement is that I can reuse the above microflow for sending email using different templates having placeholders bind to different objects. Can I made this microflow reusable or generic? For e.g. one template has placeholders for entity type Customer Second template has placeholders for entity type Order The microflow should replace tokens for Order if order object is passed or should replace tokens for Customer if customer type is passed, so that I dont need to rewrite the flow again and again for different templates. Please provide any suggestions
asked
Shikha Basra
1 answers
2
Retrieve the EmailTemplate based on the string as you already do
Create a new helper object (non-persistant) ‘EmailHelper’ for example. In this object you store the attributes of Customer/Order based on what Template is retrieved (maybe a sub flow to store the attributes in the EmailHelper object based on which template it is)
Pass the EmailHelper object to the sub MF and use this in de ‘ReplaceEmailTemplateTokens’ action
When you set your token placeholders in de client, do this based on the attributes of the new (non-persistant) entity ‘EmailHelper’