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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Populate a Microsoft W...
Power Automate
Unanswered

Populate a Microsoft Word template - dynamic file

(0) ShareShare
ReportReport
Posted on by 8

Hi,

 

I'm working on a small project that automatically populates a specific Word document depending on the user's input.

When I manually select the file path in the action, it works fine. However, when I try to dynamically select the file, the action does not show any advanced parameters to fill my Word document, and when I run the flow, I get the following error:

 

Action 'Populate_a_Microsoft_Word_template' failed: The selected file doesn't contain template elements.

 

When I take a look at the input parameters, I do see that the correct file was selected:

"file": "/Verslagen/Bevestiging intake.docx"

 

What am I missing?

Working flow, not dynamic.png
Not working, dynamic.png
Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @NickF10 ,

     

    If you open the peek code you will see that it uses the file id instead of the file path.

    vxiaochenmsft_0-1718762363715.png

     

    So if you want to populate a dynamic file, please provide the file id rather than the file path.

     

    Best Regards,

    Wearsky

  • NickF10 Profile Picture
    8 on at

    Hi @v-xiaochen-msft,

     

    Thank you for your reply. 

     

    Unfortunately /verslagen/{id} also does not work. Neither does only {id}. I receive the unique file ID from the previous step (find files in folder). The same error message is shown, and I can't fill in the advanced parameters.

     

    Attached you can see the code view when I change 'file' to the dynamic ID from the previous step.

    Screenshot 2024-06-20 at 10.12.56 AM.png
    Screenshot 2024-06-20 at 10.12.24 AM.png
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @NickF10 ,

     

    It should be 

    split(item()?['Id'],'.')?[1]

    vxiaochenmsft_0-1718872655249.png

     

    Best Regards,

    Wearsky

  • NickF10 Profile Picture
    8 on at

    Hi @v-xiaochen-msft 

     

    Thanks for the quick reply. Unfortunately, it still doesn't work. Receiving the same error and can't fill in the parameters. It seems it can't find the file. Attached is a screenshot of the code. 

    Screenshot 2024-06-20 at 10.52.14 AM.png
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @NickF10 ,

     

    It worked for me. Please share your flow run history screenshot.

    vxiaochenmsft_0-1718874060628.png

    vxiaochenmsft_1-1718874095133.png

     

    Best Regards,

    Wearsky

  • NickF10 Profile Picture
    8 on at

    Hi @v-xiaochen-msft 

     

    When I add the file manually, I can enter the values I've defined in the Word template. However, with your code, it doesn't display that. I only see 'dynamicFileSchema'. I might be missing something obvious here, so I'm sorry in advance. 

     

    Screenshot 2024-06-20 at 1.46.35 PM.pngScreenshot 2024-06-20 at 1.49.55 PM.png

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @NickF10 ,

     

    You are using wrong parameter. In your screenshot it is path.

    vxiaochenmsft_0-1718940018235.png

    vxiaochenmsft_1-1718940045662.png

    In my screenshot, it's id. Please check it.

     

    Best Regards,

    Wearsky

  • NickF10 Profile Picture
    8 on at

    Hi @v-xiaochen-msft 

     

    Thanks for getting back to me again. Hope you had a great weekend.

     

    I'm not sure why it went wrong with the ID. But now it goes correctly. However, it still giving me the parameter error. Do I need to fill in the parameters manually as a key, value pair? Because if I selected the file manually, it will give me the parameters and I just fill in the values. 

     

    Screenshot 2024-06-24 at 10.13.06 AM.pngScreenshot 2024-06-24 at 10.12.28 AM.pngScreenshot 2024-06-24 at 10.11.34 AM.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard