I don't think this is possible to read the template file name dynamically because the connector will need to load the template parameters for you to fill in the power automate flow so I suggest if you have multiple templates is to use a switch case based on a specific parameter to load your template.
I found a solution to this but it is quite ugly! Basically, when you add content controls to a document, under the hood, they get a number assigned to them. By using that number with a value in JSON format, I was able to get this to work using the dynamicFileSchema field. To make this slightly less ugly, I first pointed the connector to the file that I wanted to work with, thus exposing the content control fields. Then, I copied the actual name of each content control into the value. Once you have done that, click on the ellipses and peek code. This will give you the output of the number mapped to the field name:
Then switch back to the dynamic location/library/file and use the numbers in your JSON:
This was not quite the answer I was hoping for but I guess it is better than modifying the flow in each environment and having to remap all your values. I have not yet tried this with image controls or repeating controls.
I hope this helps someone as I wasted a good bit of time trying to figure this out and was not finding any answers from the old google machine!
Happy Power Automating!
How did you compose your filename? I keep getting the error "The request entity's media type 'text/plain' is not supported for this resource.
@MatthewBrooksST thanks for validating the repeater control. I have not tried that but I have been able to get images to work as well.
@owneyjs15 the file name should be straight forward but I suspect you are also using a dynamic SP location and library? If so, this is also a bit tricky. You have to use the id's for these values. You can find the id's by pointing the connector to the SP location and library you want to use and then using "peek code" to see the values. They are listed as the "source" and "drive" parameters.
I'm using a static OneDrive for business location. Only my file name is dynamic. Could you show me how you constructed your variable?
Could you please let us know the syntax of repeating controls. Seems like some nesting is required but I am unable to fetch the id for the repeater control.
Edit : Can see the repeater control now. It was not properly added in the document template previously .
Thank you for this! Really helpful comment - sucks there is so little documentation on the dynamic word template schema
I am new to Power Automate and I am trying to populate a dynamically derived word file. The workaround shown by @RichFunk365 is understandable. My only issue is how to compose the variable for the dynamic filename with a static SP location and library.
The trigger is "For selected file" and I want the word connector to refer dynamically to the selected file.
I'm also new in the area of PowerAutomate and have also directly a problem.
I have a list with a fixed naming scheme, I build these names with the help of a loop based on values of a SharePoint list and then load the corresponding Word template which I then want to fill with the data also stored in the SP list.
How do I manage to fill these 4 fields, since there are over 800 documents, it is unfortunately not an option to work with IF or switch / case and enter the numbers by hand.
The field names are the same in all documents.
Thanks for your help in advance.
Word Online does not work correctly when a table is included in the template, the data is displayed correctly if the generated document is opened in the browser but the data in the tables is incorrect when downloading it
Check out the News & Announcements to learn more.
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
Check out our new Discover Your Career Path blog post series and get all the details.