cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

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!

 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

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.

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

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
Highlighted
Super User III
Super User III

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
Highlighted
Advocate I
Advocate I

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
Community Support

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.
Highlighted
Advocate I
Advocate I

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!
Highlighted
Community Support
Community Support

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.

View solution in original post

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (3,606)