Using Power Automate and Syntex to create document with multiple tables HELP?

Copper Contributor

I work for a performing arts organization, and we manually create documents ("one sheets") related to performance information in tables like casts, crews, chorus details, etc.  See the example picture below.  I would like to start keeping this table data in Microsoft Lists for all the performances and use the new Power Automate Syntex function to generate these tables into the Word documents automatically.  

 

I am confused on how to go about using the Syntex function to create tables.  All of the examples and docs are showing simple examples that look like mail merges.  Does anyone have advice how to handle the tables?  

 

Note that the function will have to filter the lists to only pull in the information for that performance (which is in the list as a column), and the next document would have a different performance and so on. 

 

Help? 

rsderby_0-1677853567108.png

 

 

13 Replies

@rsderby Sorry to say I don't have a solution for this. I'm having the same problem and been hunting for a solution for many months now. I want to create an invoice that has a table with each billable item as a row in the table but I can't find any examples how to populate the table. If I use the list columns from a 'get items' it goes into a 'Apply to Each' loop so tried the 'Select' Data Operation and 'Create HTML table' and various array variables and JSON formats but it always fails.

It works if I manually create the doc via the library but not via power automate.

 

Wayne_Addison_0-1692531638866.png

Has anyone succeeded in using tables? 

@Wayne_Addison you can use a Data Operation -> Compose method to bind the items to a table in content assembly. 

Struggling with the same behavior. @Steve Pucelik @Wayne_Addison @rsderby 
I have a modern Syntex Template with a Table. The Template with Table is supported manually from SharePoint New Menu.
In Power automate action (Preview) "Generate document using Microsoft Syntex (preview)"
https://learn.microsoft.com/en-us/microsoft-365/syntex/automate-document-generation
microsoft wrote:
10. The action does not support images and tables and templates containing these fields are hidden while selecting the templates in the action.
But the Template with table is not hidden in the action (instead it is a required column) and therefore i have to add the Table Column Mapping from dynamic content. But this is not working in many variations, because i need a Apply to Each Array in the table mapping.
I guess how a Data operation compose could help for a dynamic repeating section to bind the table entries to the table in content assembly?
How can i get the action working with tables as expected?
Or does the action not working with tables as expected, because of preview state?

KarlGerdSchneider_0-1694420536664.png

 

@Karl-Gerd Schneider 

 

Consider the following Power Automate Example 

  1. This action will first get items from a SharePoint library.  Then add a Data Operation -> Select action to your flow.  Notice that the "Map" values correspond to a table I have in my Content Assembly template columns.  This will take the results from my SPO Library and save it this table structure.

 

StevePucelik_1-1694431803200.png

 

2.  Now you're ready to populate the smart template with values.  Notice that for my table I'm simply taking the JSON output that is produces from the Data Operation and binding it to the table.

 

StevePucelik_0-1694431776655.png

 

3.  The result of this will be added to the table in the smart template.

 

StevePucelik_2-1694432223840.png

 

 

 

@Steve Pucelik thanks for your hints. But i can not get it to work. I fail to send the JSON-Objekt for the Table (from a get items select filter) to the TableField in the Syntex action. I always get

 

[{"ErrorMessage":"Answer for data type 'table' has wrong format.","HasError":true},{"ErrorMessage":"","HasError":false}]
clientRequestId: b65638ae-5dfb-4100-a224-0327f8c859dc
serviceRequestId: b65638ae-5dfb-4100-a224-0327f8c859dc

 

i also get this error when i try to update the Syntex-Template-TableField with a simple JSON-Object (single Item) like this one:

 

[
{
"Nr.": "1",
"Bereitzustellende": "Test",
"Detaillierte Erläuterungen": "Test",
"Anzufordern von": "Test",
"Stand": "offen",
"Bemerkung": "Test"
}
]

 

Do you have a working example for a suitable JSON?

 

SyntexError.png

 

I tried this without success

 

SyntexFlow.png

 

Hi @Steve Pucelik and all on this thread, I've been meaning to try your solution but have been getting a brand new problem when creating the template. Whenever I define the table field I get this error:

Wayne_Addison_0-1694605144401.png

It started happening around the time MS switched new Syntex licencing from per-user to PAYG. I thought I'd be ok as my per-user was valid until Apr-2024 then I just saw this...

Wayne_Addison_1-1694605692749.png

So MS could be switching off content assembly (or at least any new features) unless you are on PAYG even if you have a legacy per-user licence. Are you guys per-user or PAYG?

@Karl-Gerd Schneider Here are some screen shots of it working in my environment.  There is also updated documentation to reference.

Here is the result of my Data Operation -> Select activity going against a library.

 

StevePucelik_0-1694779606826.png

 

When binding the information to the template, here is the input values.

 

StevePucelik_1-1694779643335.png

If you continue to have issues, I would open a support ticket and we can look at it in depth.

 

@Wayne_Addison I have noticed that when you do configure PAYG if you were previously PUPM, the templates need to be redeployed and published to the library.  Content assembly does work with the straight PAYG billing configuration.

 

Try creating a new template and publishing it to a library.  That should work.

I dont see the updated reference yet
https://learn.microsoft.com/en-us/microsoft-365/syntex/automate-document-generation
published date is the older one from 03/15/2023.

But i have already raised a Power Platform Service Support Ticket for this issue, dear @Steve Pucelik 

@Karl-Gerd Schneider and @Steve Pucelik I am still having the same error that Karl is having. I see the inputs to the create document are proper JSON format but I get the error 

 
Error
Action 'Generate_document_using_Microsoft_Syntex_(preview)_2' failed
Error Details 
[{"ErrorMessage":"Answer for data type 'table' has wrong format.","HasError":true}]
clientRequestId: 3f4cb665-5663-4fa9-b185-b6c5b053f1b4
serviceRequestId: 3f4cb665-5663-4fa9-b185-b6c5b053f1b4
 
Here are the raw inputs to the create document with Syntex request - I've verified the heading match the headings in the Word document template (removed spaces to make sure that was not the issue):
{
    "host": {
        "connectionReferenceName""shared_sharepointonline",
        "operationId""CreateContentAssemblyDocument"
    },
    "parameters": {
        "table""fc943c8d-db45-41a6-965a-ef63ff17f60d",
        "template""0x0101005F1508AB448AD04A82198A206228038C006AC7F8A786B4374AB41FB6D8D957510A",
        "fileName""MAP1.pdf",
        "item/msca602030TableSelection": [
            {
                "Ameren Illinois""OrgName",
                "Larry Magelitz""PrimaryContactName",
                "Manager-Illinois Crisis Management""PrimaryContactTitle",
                "email address removed for privacy reasons""PrimaryContactEmail"
            },
            {
                "Ameren Missouri""OrgName",
                "Pam Harrison""PrimaryContactName",
                "Director, Missouri Gas Operations""PrimaryContactTitle",
                "email address removed for privacy reasons""PrimaryContactEmail"
            }
        ]
    }
}
 
Have you found out anything through your support request inquiry?

@Steve Pucelik - I see one big difference between your working sample and my failed attempt. In your sample your json is in this format {"Correspondence Name":"Value1", "Date Sent":"Value2"} but the output from the data select action for my sample has the value first and the field name second like this by comparison {"Value1":Correspondence Name", "Value2":"Date Sent"}. Seems the data select is backwards in my case. I'll try this and respond back.

Success. It now works for me. What an idiot I am. I know the JSON format but for some reason had dyslexic response. This is now working for me. Thanks everyone.
Success for me too! My problem... I didn't put labels in the header row of the table, that was my 'Microsoft Word, Sorry, we ran into a problem' error AND when I did put labels I didnt make the JSON field names exactly match the labels. I think I'm the winner Mario.
Thanks to all on the thread.