InfoPath forms, repeating sections, and Workflow Tasks in SharePoint 2007

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.

Confusing Modification Forms and State Machines

I’m building a state machine workflow for MOSS, but as part of this we need to be able to reassign tasks to other users (in case someone is ill, on holiday, etc.)

The ECM Sample Starter Kit has an example that uses an Infopath Modification form to do just that. Looking at the code for it, I can see how it has an ‘EnableWorkflowModification’ step to, well, enable a modification form, and I looked this up on the MSDN site.

The MSDN site pages I looked at here and here discuss the scope of the enabled form. However, this seems to be related to the step it is contained within a sequential workflow. This, presumably, doesn’t apply in a state machine workflow? Or maybe it applies to the whole state (i.e. the state is the scope)- which raises questions as a state might be reached by many routes, without enabling the modification.

Blood, sweat, and Windows Workflow in SharePoint

So, I’ve been tempted to throw my machine out the window lately, working with the Windows Workflow Foundation, InfoPath and SharePoint – and as I’ve said before, at least I’m not the only one frustrated. Maybe that’s not fair – it is in beta after all – but if you’re going to release a beta, you could at least release beta documentation. Anyway, here’s what I found… Continue reading

I’m not the only one…

… tempted to give up when working with the Windows Workflow Foundation – I was glad to find another frustrated developer. I’ll blog about my experiences of this so far, once I’ve calmed down enough to be coherent. Being able to attached a UI to the workflow tasks in SharePoint would be nice too, but that eludes me.

Still, maybe that’s for the best – we’re supposed to be using Infopath 2007, and my colleague working with that has started talking to himself. In a high-pitched voice. It’s not pretty. Seems there is even less documentation about this, and both of us are left with one question – wtf d’you want Infopath for? Yes, it makes XML, but that’s pretty trivial – we’ve all written forms that do that. (Well, all the geeks in the house).

So you can have a rich client for Infopath. Um, why? Lets see, zero footprint web forms, or Microsoft install. The phrase ‘lead or silver’ springs to mind – pay silver for our client, or get shot down with our web forms. And as our form is going to display an image from another document management system, and as the client will not be using the rich client thingy, well, we’re busy puzzling what we get from Infopath over ASP .net forms, apart from heartache and ulcers.