Hi Community,
I have a requirement where I have JSON data as one of my Sharepoint list column (multiple line of text)
I am trying to generate PDF of the selected item which includes many columns along with this JSON column(Lets call it Transaction Details for better understanding)
Approach 1 : Create HTML tags based on SP list items and covert to PDF
Although I achieved this almost 90%, spending time on styling is cumbersome so switched to Approach 2
Approach 2 : Populate Word Template and Convert to PDF
Firstly, I created the word template with lots of "Plain Text Content Control" and mapping each of these control to Sharepoint list column data via Power Automate (This was straight-through)
For Transaction Details column with JSON data, I created a table in my word template(Something like this)
All the values with white background(TdTransType,TDCode etc) are individual "Plain Text Content Controls"
The entire table is selected and set as "Repeating Section Content Control" with Property Name SampleRepeat
In Power Automate, my flow is something like below
1. Manual Trigger
2. Get item (Specific SP List ID)
3. Parse JSON (SP Column Transaction Details)
4. For each Node in JSON, I am using Select(Compose)
a. Within Select Compose -> Mapping Each of the JSON node to Plain Text Content Control of the word template
b. Sample: TDTransType mapped to Body TDTransType from previous step (repeating for all the content controls)
c. Sample Array :
{
"TdTransType": Body TDTransType,
"TDCode": Body TDCode,
"TDBankName": Body TDBankName,
"TDCampus": Body TDCampus,
"TDTransNumber": Body TDTransNumber,
"TDStartDate": Body TDStartDate,
"TDEndDate": Body TDEndDate,
"TDBranch": Body TDBranch,
"TDAmount": Body TDAmount,
"TDBalance": Body TDBalance,
}
5. As next step, I am using Populate a Microsoft Word Template (Premium action)
a. Mapping all other Plain Text Content Control outrightly from Get item step (working perfect)
b. Mapping SampleRepeat (Switching to input entire array) - mapping the Output of Step 4 [Sample Array shown in Step-4c above]
While the table is generating dynamically based on the items in JSON ( For ex: If there are 3 child nodes in JSON, the above table of 6*3 is dynamically rendered 3 times), The values are not appearing on the Plain Text Content Control inside Repeating Section Content Control
For a Sharepoint list item where the Transaction Details JSON has 3 nodes, the word is populated like below
There is a another table in word template, where the layout is different (1 header and multiple rows)
For the above table, selected only the row(without header) as Repeat Section Content Control and each cell(TTName,TTID etc) as Plain Text Content Control
But same issue for both tables.
I know the JSON loop and extract is working as the repeating section content is repeating exactly the times of JSON nodes [Tested multiple times]
Troubleshooting steps so far
1. Checked all values in run time in Power Automate - All values passing successfully
2. Initialized an Array and appended this array with JSON data and then passed on this Array to Populate Word Template Step (Same output)
3. Changed the Repeating Section property from Bounding Box to Start/End Tag (Same output)
I am fairly new to Power Platform and I'm sure there is some minor tweak to fix this issue. So, here I am seeking expert insights to this issue.
P.S : All the terms and sample shared in the post is created for this question, it is entirely different from actual terms used (morphing names for security)
Thankful and grateful for taking time to help.
Cheers,
SP