>
Well that is until I wanted to include the contact selector inside the modification form. As I mentioned the workflow allows a user to approve the list item, however what if the user is away or want someone else to approve it. Well then a simple workflow modification should sort that, shouldn’t it?!
In order to create a workflow modification you need to do the following:-
- Create a form to use for your modification
- Update the workflow xml with a modification tag which has a unique GUID and contains the URN of the form that the workflow is going to use.
- Implement a EnableWorkflowModification which references the GUID that it is modifying, this is the part where the problem existed (more on that later).
- Implement a Event Listener activity so that when the modification occurs there is something listening for it!
- Finally implement the handler which updates the workflow and related objects so that the modifications are made.
So starting with point 3 firstly, so what does an EnableWorkflowModification activity do?
Well it should log that the modification has been activated, it also then assigns the default data that should past into the modification form. Now this is the interesting part, how do you make the xml form data that the InfoPath form requires?
This is used within the EnableWorkflowModification activity to generate the xml ContextData which is then loaded into the Modification form.
This would be achieved like so:-
ReassingForm reassignForm=new ReassingForm();
reassignForm.ReassingComments = "The workflow is being reassinged from " + m_sApproverLogin;
reassingForm.Approver = ApproverArray;
Here we are assigning the current approver and also uploading some comments to the form, which the user can then update as required.
Finally the class needs to be serialized :-
Now when the workflow modification kicks in then a user gets a link in the workflow status page allowing them to perform the modification. When this is clicked then the Context Data is loaded into the InfoPath form and the InfoPath form is displayed.
When the contact selector is used an error will occur complaining about the fact that the my namespace prefix is not found. So how do we get around this?
We need to tell the serialization method that it should add my prefixes so the xml instead of being like this :-
This would look like:-
XmlSerializerNamespaces nsReassignForm = new
XmlSerializerNamespaces();
nsReassignForm.Add(“my”, “http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-05-29T12:53:57“);
This will then fix the error on form and allow the contact selector to be able to process and store the users that you have provided.
Let me know how you get on.
>I have been trying to bypass the workflow status page with the link and go directly to the modification page. I don’t know if you have tried to do this before but please let me know at chopshoolihan@hotmail.com.
>Have tried but this namespace serialization solution doesnt work..can u provide some other help about this Unknown error on using contact selector with workflow modification forms