Changing dynamic fields while doing Email Automation

Hi @Florent_Salendres @badita @vvaidya
can any one advise how to replace several dynamic fields while sending email

my steps are as below:
create new email
search for template based on certain query
check if any dynamic field are present or not - if present then replace
send the mail

fyi there are more than 10 dynamic fields in every template
so i am trying put all these 10 dynamic fields in config file or should i create a dictionary



I like to approach that kind of problem using a textfile for the as template:

Dear @fullname  

Please find attached the report data:


Please reply before : @replybefore

You can then use an expression like this one replace:

strBody = strBody.Replace("@name","Florent").Replace("@reportdata","SomeDataTableOuput").Replace("@replybefore",Now.ToShortDateString).

Hope I understood your query correctly, if not could you please shared more detailed example?


1 Like

Thanks @Florent_Salendres
i have 20 different templates
each template have some dynamic fields which may or may not be present another templates
for example
template1 has dynamic fields as {fullname},{birth place},{reportdata}
template2 has {first name},{reportdata}
template3 has {fullname,replybefore},{age}

so how should i build a logic to find these dynamic fields and then replace all of them
should i create all known dynamic fields in dictionary ? if yes how can i acomplish

If you replace something that does not exist, that will simply.

Wouldnt this still handle your case then?

1 Like

do you mean to have just one equation for all cases so i need not setup a logic to find particular dynamic field
as below
strBody = strBody.Replace(“@name”,“Florent”).Replace(“@reportdata”,“SomeDataTableOuput”).Replace(“@replybefore”,Now.ToShortDateString).

Exactly, if in one of the template, a field placeholder isn’t present it will simply ignore it.

1 Like

well thats solve my half problam …Thank you very much
another query is about how should build a dictionary for all these dynamic fields
any idea?

I would use an invoke workflow having arguments with the replacement values.
A dictionary is a viable solution if you really have many of them, coming from difference sources.
Maybe you should consider having those values in your QueueItem, if it fits your design.

To add to dictionary, you have an example on this post.

A datatable is a viable option as well, it depends on your preference.


1 Like

Thank you very much

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.