There is an interesting control that you can use in Nintex Forms called the Repeating Section. It gives users who are filling in the form, the ability to dynamically add extra entries.
One example of this, would be a dynamic Annual Leave request form. Each entry in the Repeating Section would contain a Start Date, End Date and Description. This would save an employee from having to fill in the same form several times, and instead they just fill in the one form.
Although this is a great addition to Nintex Forms, there’s no control in SharePoint that can really handle this data nicely. You need to be able to parse the data that is filled in and do something with it. In comes Nintex Workflow to the rescue.
A simple Nintex Form with a Repeating Section that is published to a List.
When a user fills in the form to create an item, they can fill in a number of records in the repeating section. But once the form is submitting, we need to get the records and do something with them.
This is what the form looks like:
When a Nintex Form is submitted to a list, the item has a property called “Form Data”. This is the XML representation of the entire form. If we have a repeating section in the form, the form has a hidden ID and the Form Data will have a node with that ID. So to make it easier for us, we will give our Repeating Section a name like (MyRepeatingSection).
The repeating section will have two Single Line of Text controls. To make life easier, we will also give them names:
To get the value of the repeating section from the XML, we can now use the following XPath expression:
The value of this XML node is an encoded XML document. So we need to decode it using a Build String action and an fn-XmlDecode inline function call. We now have an XML document that we can query using a Query XML action.
I won’t go through example of the Query XML action or the Xml Decoding. I’ll leave this as an exercise for the reader. Instead, I thought that since this part is reusable, I’ll create a User Defined Action that will do it for me. There could be multiple records in my repeating section, so I will get the UDA to return the internal XML document and also the number of internal Items. then
So now that we have the XML and the number of items, we can then use a Loop action to iterate through each item and retrieve the item control values.
I’ll leave it up to you to take a look at the UDA and the Workflow, since going through it here is probably super boring.
But what I will provide is a screenshot of calling the User Defined Action.