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
Hi! Same problem here!
I have tried to dynamically compose the file outline using compose for the array with the loop values. As you have shown in your attached image, but it still doesn't work.
The traces of the Compose Exectution:
Populate Template Word Function:
-The dynamicFileSchema seems to be ok....
In the document, the table is not properly filled:
Although the result of the schema values after execution is the same, as if we did not do it with a file schema, we can see the same results as if we did it with a schema.
Traces of an execution without schema of the populate word function:
Please help!! And Thank you in advance
Note: English is not my native language, sorry for the mistakes.
First, make sure the table in the document is in a repeater and the repeater id is -16086....., second, put the 5 merge fields in separate columns in the table row, make sure the name of the merge field you added match the property name in the JSON you passed from flow. See below:
I could solve it! Thank you very much!
The trick to solve is
My mistake was that when I used the compose function, the beginnings of quotation marks were escaped.
Please could you consider it as a solution.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.