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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Repeating Content Cont...
Power Automate
Unanswered

Repeating Content Control issue with Apply to Each

(0) ShareShare
ReportReport
Posted on by 132

Hi,

 

I am running into an unusual issue when using Apply To Each to capture multiple related records and populating a Word template that includes the Repeating Content Control. What's happening is my values from Apply To Each are getting "duplicated" in the table in Word. So instead of the correct related records, it's showing the first record values repeating in the table. My flow runs "successfully" so I can see where the related record values are getting captured but I can't figure out why the values are getting duplicated instead of repeating the unique values like I think it should. Here are some screenshots for clarity. Is there any way around this? Possibly a way to do this without the "Apply to Each" action?:

 

record1.pngrecord2.pngwordtable.png

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    Hi!

    Can you share an screenshot from your flow design, so we can see the input to Apply to each etc?

    The more context info we hve, the fastest to get a useful answer

    Thanx!

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @phildrake198 

     

    Please make sure you followed the below instructions:

    Guide for using Repeating Section Content Control in the Word Online connector.

    We're enabling repeating tables in the Word Online connector. When creating a template in Word, you need to add the Repeating Section Content Control. This is the control in the developer tab that helps us create a repeating table. Repeating Section Content Control enables users to repeat rows in a table and plain text. Here is a guide to work with the Repeating Section Content Control:

    1. To make a template with repeating text: First add a Repeating Section Content Control from the developer tab. Then add Plain Text Content Controllers within the parent repeat content controller. Any text that is outside a nested content controller would be static. While adding the nested content controllers, make sure to go to properties and add a unique title for them. For example, if the template looks like I would like to a and b Then the user can dynamically change the values of a and b.

    2. To add a repeating row to the template, simply add a table, select the full row (which you want to repeat) and select the repeat content controller from the developer tab. Now you can add nested plain text content controllers in the columns that you want to be dynamic. While adding the nested content controllers, make sure to go to properties and add a unique title for them.

     

  • pdr469 Profile Picture
    132 on at

    Sure. Here's some more detail that will hopefully be helpful. What I'm trying to do is have it pull values from related records in Dynamics and then put those values in a table that uses a repeating content control in Word. The challenge is, when you use "Apply to Each", you can't pull values from within that Apply to Each in the Populate a Microsoft Word Template action. So what I've done to work around this is initialize a variable outside of that Apply to Each and then use "Append to Array" within the Apply to Each to call that "initialize variable". Then, in "Populate a Microsoft Word template", I can "switch to array" on the repeating content control fields and then add the variable. The problem I'm running into is it just doesn't add second set of values even though they are returned in the results.

     

    Here are some screenshots of the flow logic for more detail. Maybe I'm doing something wrong:

     

    productvariable.png

     

    applytoeachcondition.pngproductvaluearray.pngpopulatewordtemplatewithvariable.png

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @phildrake198 

     

    Did you do the following?

    While adding the nested content controllers, make sure to go to properties and add a unique title for them. 

     

    Thanks

  • pdr469 Profile Picture
    132 on at

    Yes I added titles for the controls, although I did notice that I forgot to add a title for the repeating control. So I went back and did that but it still doesn't display the data beyond that first set of values. I made sure to add my file back in and made sure the Populate a Microsoft Word Template action was updated to call the updated file. Based on what I've described, is there anything else that needs to be done here?

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @phildrake198 

     

    I did tried this and it is working as expected.

     

    Could you please try the following:

     

    1. Change the array structure as following:


    Product Part Number 1 to ProductPartNumber
    Description 1 to Description
    Quantity1 to Quantity
    Rebate1 to Rebate

     

    2. Make sure Populate word template is outside the apply each loop

     

    3. Open the word template.

     

    4. Remove the current table.

     

    5. Save the template.

     

    6. Add a new table x 4 rows

     

    7. Add the heading

     

    8. Press tab (this should create new row)

     

    9. Highlight the whole row and add repeater control

     

    10. Select properties of the repeater control and add the name as ProductDetails and set the tag as same name.

     

    11. Next place your cursor in first cell of the second row, add a text box, select properties and set name and tag as ProductPartNumber.

     

    12. Move the cursor to next column. Repeat the same as step 11 for Description, Quantity and Rebate.

     

    13. Next back to flow again and remove the current word template step.

     

    14. Add word template again and click the T sign, this will join all the columns into one. Here place your array variable.

     

    15. Save and run the flow.

     

    Let me know how it goes.

  • pdr469 Profile Picture
    132 on at

    Ok that did solve the additional record values not showing up. The problem now though is both record values are being duplicated in the word doc in that table. Is yours pulling the record values from Dynamics like mine is and if so how did you get it to not duplicate? My Populate a Microsoft Word Template action is outside of that Apply to Each condition so I'm not sure why it's duplicating the values in the doc. Or is there some expression I can add that will resolve the duplicates?

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @phildrake198 

     

    Make sure your arrays have no duplicates. It's difficult to see without checking the runtime history and your template. I did send you an email earlier. Please check it.

     

    Thanks

  • pdr469 Profile Picture
    132 on at

    Thank you! Yes, It duplicated because there was an additional "Apply to Each" at the beginning of the condition. So it was an "Apply to Each" within an Apply to Each. Once I removed that extra action, it worked.

  • krastevkrs1 Profile Picture
    6 on at

    I had a similar problem and ended up looking at the word template. I changed the docx extension to zip and inspected the xml files. It appears that when the malfunction happens the file settings.xml file had a line for the formsDesign class.

    When I deleted the line and replaced the settings.xml all content shows correctly.

     

    Hope this helps anyone.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard