This was just bound to not work
So, the project I’m working on needs a repeating section in an InfoPath form, which is being used as the display form for a Workflow Task. (Well, apparently it is ‘required’).
InfoPath forms hand back their data into a SPWorkflowTaskProperties object, and custom data - including all the fields on the form - gets put in the ExtendedProperties ‘Dictionary’ (or Hash table, if you’re like me).
The thing is, the items in that hash table are keyed by the name of the field on the form. For example, the following would get the value of the ‘name’ field:
x = AfterTaskChangedProperties1.ExtendedProperties["name"];
The thing about repeating sections, though, is that those field names will be repeated. But the hash key must be unique. So how are repeating sections represented.
I built a form to test this out. When the task was changed, I logged the key and value of everything in the Extended Properties. There were some other things in their - ’standard’ extended properties - and I’ve stripped them from the log below.
What I did was I opened up the form. I filled in the fields. The repeating section was shown once - one line on the ‘UsersLog’ section. I filled it in, added 2 rows, and filled them in. I then submitted the form. Here’s what the log said:
"DocumentURL" = "Kumquat"
"UsersLog" = "
<ns1:User xmlns:ns1="urn:soj-deltascheme-com.invoiceapproval">
<ns1:NetworkId>1234567890</ns1:NetworkId>
<ns1:Name>AndyData1</ns1:Name>
</ns1:User>
<ns1:User xmlns:ns1="urn:soj-deltascheme-com.invoiceapproval">
<ns1:NetworkId></ns1:NetworkId><ns1:Name></ns1:Name></ns1:User>
<ns1:User xmlns:ns1="urn:soj-deltascheme-com.invoiceapproval">
<ns1:NetworkId></ns1:NetworkId><ns1:Name></ns1:Name></ns1:User>
"
"InvoiceId" = "Juggernaut"
"InvoiceCategory" = "34134"
So, the repeating section gets handed in as a chunk of XML. Great! That could be really useful - except…
Except that it is missing the data from 2 of my lines! It’s got the correct number of ‘ns1:User’ nodes (3), but only the first one ever has data. I’ve repeated, this seems to always be the case.
Bug. Let’s hope the tech refresh fixes it, ‘cos I can’t build the workflow I’ve been asked to with Beta 2.