cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AVividLight
Level: Powered On

Access Variable at Runtime

Hello,

 

I would like to store HTML email templates in a SharePoint site library and pull those templates into a flow, populate them with variable information, then send them with outlook.

 

The logic seems very simple, but I haven't been able to get the variables to be substituted into the template in the flow; the email is sending with fields like @{variables('Staff Email')} instead of actually using the variables' values. When I copy and paste the template HTML text into a compose action in the flow it sends with the correct information.

 

Is there a way to do this successfully?

 

Thanks!

 

EDIT:

@ScottShearerThank you for your comment. This is an example of what I have already tried:

 

Flow.jpg

That last expression is

 body('Get_file_content')

 

And the HTML file consists of

@{variables('Test')}

 

The email would contain the body @{variables('Test')} instead of Hello, world!

 
6 REPLIES 6
Super User
Super User

Re: Access Variable at Runtime

@AVividLight 

Can you post a screen shot of your email configuration screen from Flow?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Super User
Super User

Re: Access Variable at Runtime

@AVividLight 

I suggest switching back to the original send email action (not V2) and setting is HTML? To yes.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
AVividLight
Level: Powered On

Re: Access Variable at Runtime

Hi @ScottShearer, thank you for the suggestion.

 

I just tried using the original Send Email instead, but that had the same result.

 

Thank you for your help!

Highlighted
Community Support Team
Community Support Team

Re: Access Variable at Runtime

 

Hi @AVividLight ,

 

This is my test, please check it and see if it helps:

95.PNG96.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AVividLight
Level: Powered On

Re: Access Variable at Runtime

Hi @v-bacao-msft,

 

Thank you for your suggestion. I am able to put variables in the email action from the Dynamic Content menu, and HTML is rendered correct when I load it from a file, but the problem that I'm having is when the file content contains a variable, like

@{variables('Test')}. Instead of pulling in <p>Hello</p>, I get plain text @{variables('Test')}.
 
I appreciate your help and hope that you might have more insight about a solution to this.
 
Thanks!
Community Support Team
Community Support Team

Re: Access Variable at Runtime

 

Hi @AVividLight ,

 

If it is a reference to such a variable contained in the file content, I am afraid it will be displayed as plain text.

 

Because the reference to Dynamic content is similar to expression, either directly refer to Dynamic content in the field, or edit it first in Expression and then apply it to the field.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,531)