Microsoft Office SharePoint workflow can be described as a series of tasks implemented with specific business needs to help people manage their project tasks. In Microsoft Office InfoPath 2007, we provide the workflows user experience for InfoPath forms. Additionally, we enable InfoPath business logic to key off workflow properties.
This article will demonstrate how to enable an InfoPath form to respond to workflow status. Let's explore the following scenario: Nicholas has created an expense report form template and has associated it with a form library with the “Approval” workflow defined. He wants a form to be displayed at different view when the workflow for that form is approved.
Step 1: Create a expense report document library by publishing a form template
• Launch Office InfoPath 2007.• Create your expense report form template with two views. For example, one is the expense detail view and one is the summary view.• Click the File menu | Save to save your template.• Publish your form template to a new document library on a SharePoint site. Name the library ‘Expense Report’.
Note: please leave the form template open as we will come back to customize this template more in later sections.
Step 2: Switch to SharePoint and add an Approval workflow to the expense report library
• Navigate to the SharePoint site.Note: you will see Expense Report library created on the SharePoint site.• Open the Expense Report library.• Add an Approval workflow to this Expense Report library via Form Library Settings | Permission and Management | Workflow
Note: When adding this workflow, you can specify how, when or by whom a workflow to be started and other options regarding how this workflow should work.
Step 3: Switch back to InfoPath and add a data connection
This section explains how to add a secondary data connection to query the workflow status of the workflow you added in the previous section. This secondary data connection provides the data that enables business logic in the form to switch views according to the status of the workflow.• Switch back to InfoPath. You should still have your expense report form template opened from step 1.• Add a Data Connection that receives data from Expense Report library via Tools | Data Connection | receive data from SharePoint library or list.• On the page of Select fields, select the check box next to the name of the field that matches the workflow name.• Click Include data for the active form only, and then click Next.Note: this step is the key point to retrieve current form’s workflow status.
• Follow all the default options to finish the Data Connection Wizard.
Step 4: Add a Rule to the form template to switch to a specific view according to current form’s workflow status
For this example, we want to add business logic to the form that it will switch to summary view when this form’s workflow is approved. This can be achieved by applying an on load Rule to switch view when current form’s workflow status is equal to “Approved” status.
• Set on load Rule via Tools | Form Options | Open and Save | Rules • When setting Condition, you want to select the workflow status field from the secondary data source you added in the previous section in your first dropdown of the condition builder• In the second dropdown, choose "is equal to".• In the third dropdown, click Type a number, and then type the value that corresponds to the workflow status.
In our example, we choose number 16, corresponding to status "Approved".
Step 5: Republish the form template
• Click the File menu | Save to save the changes you made to the template.• Click the File menu | Publish. • Since you republish the form template, the Publishing Wizard will repopulate previous values. Click Nexts -> Publish -> Close to finish the Publish Wizard.
Now you have successfully designed a workflow driven expense report form template. When a user fills out an expense form from this library, the view of the form will be displayed according to the status of the workflow.
Emily ChingSoftware Design Engineer in Test
When you say "SharePoint", do you mean specifically Microsoft Office SharePoint Server 2007? Or does this also work on Windows SharePoint Services v3?
"SharePoint" in this blog refers to Microsoft Office SharePoint Server 2007. Thanks.
Hi Emily Ching,
Did this work with windows sharepoint and browser-Compatible form with more than one sencondary data sources?
I had a form with two secondary data sources, one was used to get workflow status, and another one was used to get data for a drop down list. The first time create a new form, it works fine, the form was able to save to a form library in sharepoint, but when an existed form was open, and tried to save it again, it alwasys show me the error:
Unexpected end of file while parsing Name has occurred. Line 1, position 226.
System.Xml.XmlException: Unexpected end of file while parsing Name has occurred. Line 1, position 226.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseQName(Boolean isQName, Int32 startOffset, Int32& colonPos)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Office.InfoPath.Server.Xml.InfoPathXmlDocument.Load(XmlReader reader)
at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.Server.Diagnostics.ULS.SendWatsonOnExceptionTag(ULSTagID tagID, ULSCat categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObject..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObjects.<>c__DisplayClass2.<.ctor>b__0(EnhancedBinaryReader innerReader, DataObject& newObject)
at Microsoft.Office.InfoPath.Server.Serialization.EnhancedBinaryReader.ReadObjectMap[KeyT,ValueT](Dictionary`2 map, ItemReaderDelegate`1 readKey, ItemReaderDelegate`1 readValue)
at Microsoft.Office.InfoPath.Server.Serialization.EnhancedBinaryReader.ReadObjectMap[ValueT](Dictionary`2 map, ItemReaderDelegate`1 readValue)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataObjects..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState.DesterilizeVersion1(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState..ctor(EnhancedBinaryReader reader, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionState.CreateFromByteArray(Byte serializedSessionState, Byte serializedVersionState, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DocumentSessionStateManager.GetSessionState(HttpContext context, String editingSessionID, Solution solution)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.Document.LoadFromSession(HttpContext context, SPSite contextSite, EventLogStart eventLogStart, Solution solution)
If I deleted one of the secondary data sources, The form can be saved again.
Any help will be apprecaited.
環境： Office SharePoint Server (MOSS) 2007 Visual Studio 2005 Office SharePoint 2007 SDK (ECM Starter Kit)
環境： Office SharePoint Server (MOSS) 2007 Visual Studio 2005 Office SharePoint 2007 SDK (ECM Starter Kit
Here i'm having the same problem. I've tryied to figure out what it can be, but, after have ruled out things like:
* A drop down sharepoint fed list can cause the problem -- NO
* There is residual datasources in myschema.xsd -- no
All i can think is that we have found a bug?
Thx you in advance!
I'm also getting
"Unexpected end of file while parsing Name has occurred" as well as a number of other parsing related errors while using Infopath \ Form services. (I also sometimes get "Exception Message: There is an unclosed literal string")
The forms work correctly in the infopath client and show no browser compatibility errors however they result in failing forms and errors such as the one above in the SP logs.
I have for instance, added the 'close form' command to a form's submit rule. This caused the form to fail with the error above. I take the command off again, re-publish the form and it's still broken.
I think that sometimes infopath leaves something nasty in the source files or generates invalid xml and once it's in there you can't get it out again.
I currently save a version of the form to a source code control repository every time I make a change so that I've got something to go back to should this happen.
The error "Unexpected end of file while parsing name" is not isolated to workflow forms - this is a known issue with InfoPath browser forms.
The cause of this error is having secondary data connections in your InfoPath form template (the XSN) that are not being used anywhere in your main data source (DOM.)
You can either remove any data connections that are not being used or if you would prefer to keep those connections then simply add a "dummy" node in your data source for each one that is not being used and set the default value for that new node to some field from that data source.
Una vez mas nuestro querido amigo InfoPath Services ha hecho de las suyas... con un par de errores que
Body: Una vez mas nuestro querido amigo InfoPath Services ha hecho de las suyas... con un par de errores
Workflow Definition Schema for InfoPath Forms http://msdn.microsoft.com/en-us/library/ms545033.aspx Workflow
I have InfoPath 2010 installed on my system which I used to create an InfoPath 2007 form template. I performed all the steps as mentioned in this article. I do not see the name of the workflow that I created on the forms library. This is strange. Is this feature not available when creating 2007 forms using InfoPath 2010.