I have a NWC workflow with a Form as a Start Event. The form has multiple fields, including 2 simple repeating sections (2 text fields in each section - attached).
Once the Cloud form is submitted, an item is created in a SharePoint (O365) list.
In the ''Create an item'' action I have inserted the repeating section data from the Start form, into multiple lines of text fields in the list item. The text fields in SharePoint are set to "plain text".
Once the list item is created, a list workflow uses ''Query XML'' to get the repeating section data ("Name of Course'' and ''Training Covered'' - attached). The workflow then generates a PDF which gets attached to the list item (PDF also needs the repeating section data added to it).
All of the above worked fine until I tried adding the Repeating section data. Now when the list workflow runs it error when trying to Query XML with the following error:
XML content is invalid. Data at the root level is invalid. Line 1, position 1..
I have not had issues doing all of the above using a Nintex list form and workflow but I can't seem to work out how to get the repeating section data from a NWC form, into a SharePoint list item?
It looks you already processed the repeating section data from NWC form and copied it to SharePoint list item as a plain text. Again you are processing that column using list workflow, since it has a plain text and no xml structure, you get that error. What you can do is.... instead of copying the repeating section data as a plain text, copy it with xml structure. Because the "Query XML" looks for valid xml data. If not, you get error, XML content is invalid. Data at the root level is invalid. Line 1, position 1..
Tip - Simply copy the xml content of the repeating section as is to another column in the list and try querying that column to test.
Hi, thanks for you help. I'm not exactly sure what to do here? In my NWC workflow I create a list item as shown, and populate the list text field ''TrainingRepeatingSection". The created list item field looks as shown below but I don't know how to get the two field values ("Course Name" and "Training Covered") from this for use in my generated document.
Can you please explain in simple terms what I need to change, and in which workflow - the NWC one or the list workflow?
Hi @lindi ,
Here's a fairly simple solution I've come up with to accomplish this. There may be other ways to do it, but this worked for me.
NWC repeating section data is not stored in XML format. So, what we need to do in the NWC workflow is loop through the repeating section data to aggregate the data and also apply formatting to the repeating section data. This can be whatever formatting makes the most sense. In my example, I've gone with concatenating the individual control values into a semi-colon separated text string. On the SharePoint Online side, I've created separate columns in my list for each control in my repeating section (Names and Emails). I'll store the semi-colon separated text strings into the appropriate column when I create the item in the list.
In the workflow on the SharePoint Online list, you will no longer need to use Query XML actions to parse the data and store it in a collection variables, instead you can use Regular Expression actions to split the text strings and store them in collection variables. I've also use Remove Last Item from Collection actions to clean up the empty value created as the last item in the collection after the string is split.
This is just one way to accomplish this. Give it a try and see if it works for you.
I would be remiss if I did not mention that in the very near future, the Generate Document action in NWC will support creating tables of data in documents based on collection variables. So, soon you will be able to accomplish this whole thing in NWC. Yay!! Check out the roadmap to learn more
I've tested this but can't get the repeating data in my generated PDF document. I've followed the instructions exactly as suggested. The 2 SharePoint list fields storing the data ("Course" and "Training Covered") shown below with 3 test rows from the NWC form.
In the document generation action (Table Data) I have set up as follows:
In the PDF itself I have tagged as follows:
Thanks for your help!
Hi @lindi ,
It looks like you are missing a delimiter (character that separates the individual entries in the string) in your text strings that you created in step 2. I chose to use the semi-colon character in my example:
This is critical for the regular expression actions that are used in the SharePoint Online workflow to split the text strings into collection variables. If the delimiter doesn't exist in the string, the string won't be split and the resulting collection variable won't contain the values you expect. I've edited my original reply to include specific instruction about inserting the delimiter character.
In your SharePoint Online workflow, I recommend using a couple of log to history list actions to log the value of the collection variables after the regular expression actions. This will allow you to see if the collection variables are populated as expected.