web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Text with dynamic ...
Power Automate
Suggested Answer

Get Text with dynamic content

(0) ShareShare
ReportReport
Posted on by 29

Hi All

Havent fround a solution to this yet. Has anybody got an idea?

Looking to import a .txt file (or orther format, if needed) as the body for an email. This text file however shall include dynamic content.

TheFactorY_0-1697617835164.png
The .txt file has following content:

Dear @{outputs('Create_TFY_DataPartner_Entry')?['body/FirstName']},

This is only a test if dynamic content can be imported.

 

I was actually expecting the compose function to take up on the dynamic content. However it just produces the raw text version:

TheFactorY_1-1697618038709.png

 

 

Anybody know how to import dynamic content?

Thanks!!!

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @TheFactorY 

    This is because you're writing the expression as "dynamic content" instead of using "expression":

    outputs.png

     

    Hope it helps!

    Ferran

  • TheFactorY Profile Picture
    29 on at

    Thank you Ferran

     

    But im not writing anything. I want to import it from a .txt file...

     

    I can copy paste " @{outputs('Create_TFY_DataPartner_Entry')?['body/FirstName']}" and it immediately gets recognised as expression. But when i import it trough a .txt, it does not ...

     

     

     

  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @TheFactorY 

    Let's see if I'm able to understand your problem. This is the test I've did and it works:

    file-content.png

    Questions:

    a) Is the content of your file in JSON format?

    b) Why are you using "Body" instead of "File Content?

     

    If the file is based on a JSON structure, then you need to parse it using "Parse JSON" and specifying the format.

    Hope it helps!

    Ferran

  • TheFactorY Profile Picture
    29 on at

    Hi Ferran

    Thank you for your time! 
    I do have the same setup and it work. What does not work:

    If in your sample text you add a dynamic content (example: @{outputs('inserttext')} the output of compose will show 
    @{outputs('inserttext')} in clear text
    instead of the output of "inserttext"...

    Does this make sense?


  • JOAS_Niels Profile Picture
    180 on at
     
    Did you find a solution to this problem? I'm trying to do the same thing, with no succes.
     
    Regards,
     
    Niels
  • Suggested answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at
    Hi All,
     
    This is unfortunately not a thing: a text value can't be recognised/evaluated as a Power Automate formula.
     
    However, what you can do to achieve similar functionality, is to use this "Super Switch" as described in a blog by David Wyatt: Power Automate - The Super Switch - DEV Community
     
    In a nutshell, the article describes how you can parse a text to JSON to set the parameters for an HTTP action or child flows to perform the actions you want.
     
    Perhaps not as easy to implement, but certainly there will be scenarios where this is the pattern to use.
     
     
    If this reply helped you in any way, please give it a Like 💜 and in case it resolved your issue, please mark it as the Verified Answer ✅.
  • Suggested answer
    JOAS_Niels Profile Picture
    180 on at
    I found an easier solution to the problem.
     
    I first use the action "Get file content using path" to get the content from an HTML file (this can also be a txt file). This is a example:
     
    <p class="editor-paragraph">Dear Sir, Madam,&nbsp;<br>
    <br>Your <strong class="editor-text-bold">[Certificate]</strong> certification is about to expire in <strong class="editor-text-bold">[Days]</strong> days. &nbsp;<br>
    <br>Could you please send us a valid certificate? &nbsp;<br>&nbsp;</p>
    <p class="editor-paragraph">With kind regards,</p>
    In this example I use two "placeholders", where I would like to have my dynamic content, namely:
    [Certificate]
    [Days]
     
    You can name the placeholders whatever you want, unless they are unique in the text.
     
    The next step is to just use a compose action with a replace function. In this case:
     
    replace(body('Get_file_content_using_path_-_Email_body'),'[Certificate]', items('For_each_Column')['Certificate'])
    You replace the placeholder text with the dynamic content you want (in my case "items('For_each_Column')['Certificate']".
     
    For the second placeholder you use another compose step, but now you use the output of the previous compose as your input.
     
    The last step is to use the output of your last compose action as input for your email body in your mail action (as HTML).
     
    Hope this helps!
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard