Open Workflow Initiation form after InfoPath form submit
Requirement
After users complete an InfoPath web browser form, we want the user to be redirected to the approval workflow initiation form after the InfoPath form closes. We could not use the option to start the workflow on item creation as we needed to user to select an approver or multiple approvers.
Solution
We managed to get this working by creating a page with an InfoPath form webpart and a data view web part. The InfoPath form sends a configured set of parameters to the dataview webpart upon submission. The dataview webpart is then configured with a HTTP redirect so that it opens the workflow initiation form as soon as it receives data from the InfoPath form.
Configure your InfoPath form submit rule
- Select your submit button -> Manage Rules
- Ensure that ‘Send data to web part’ is set after ‘Submit using a data connection’.
Configure the Form Parameters
- Open your InfoPath form -> File -> Form Options
- Under Property Promotion, add at least one property to identify each item in the list. You may add additional items if you wish to do filtering.
- Click on OK and Publish your form when done.
Creating a new page and add the InfoPath form and Dataview Webparts.
- Open SharePoint Designer 2010 -> Site Pages -> New Page.
- Add an InfoPath form webpart and link it to your form.
- Add a dataview webpart and link it to your form library.
Configure the Dataview webpart
This webpart is simply used to get data from the InfoPath form, build the URL to the workflow initiation form, and redirect the user to it. After configuring the webpart, you should set its status to hidden.
- Select your dataview webpart -> Options (on the ribbon) -> Add/Remove Columns
- I selected only the ‘Name’ column as this webpart is going to be hidden anyway.
- Under Parameters (on the ribbon), add your filter attribute and unique identifier. In my case, I used ‘RequestNo’ to uniquely identify each record, and ‘RecruitChoice’ as a filter.
- With your parameters set up, click on Manage Connections (on the ribbon).
- Add a new connection with action ‘Get Parameters from’.
- Select ‘Connect to a Web Part on this page’ -> Target Web Part: InfoPath Form Web Part
- Target action: Send Data To
- Map the parameters in the InfoPath form to the parameters you set up in the dataview webpart.
- Click finish
The next thing you need to do is set up a filter on the Dataview Webpart.
- Select the Dataview Webpart -> Filter (on the ribbon)
- Map the promoted property from your InfoPath form (in my case it is RequestNo) to the parameter you created for the DVWP ([RequestNo])
- Click OK.
Modify the Dataview Webpart’s XSL template
On the same page, switch your view to Code view (if you haven’t already done so).
Look for the line that says:
<xsl:template name=”dvt_1.rowview”>
..
..
</xsl:template>
Replace its entire contents with the following code, changing the parts in blue to suit your environment and requirements.
Note: In my case, I wanted to start seperate workflows depending on whether RecruitChoice = ‘staff’ or ‘workforce’.
<xsl:template name=”dvt_1.rowview”>
<tr>
<td>
<xsl:if test=”contains($RecruitChoice, ‘staff’)”>
<meta http-equiv=”refresh” content=”0;url=http://sharepoint/_layouts/IniWrkflIP.aspx?List=c4ea0309-8025-4997-a438-1b9b2443ba8b&ID={@ID}&TemplateID=7d892fbe-052d-4c53-9f73-b7347c5364e5“/>
</xsl:if>
<xsl:if test=”contains($RecruitChoice, ‘workforce’)”>
<meta http-equiv=”refresh” content=”0;url=http://sharepoint/_layouts/IniWrkflIP.aspx?List=c4ea0309-8025-4997-a438-1b9b2443ba8b&ID={@ID}&TemplateID=253f428b-e505-4dc3-87f1-954d3a5adbfc“/>
</xsl:if>
</td>
</tr>
</xsl:template>
Save the page and test the form.
If you have configured everything correctly, save the page and open it in the browser.
Complete the form and test with the parameters you specified earlier.
Your form should automatically direct to the workflow initiation form after you click the ‘Submit’ button.
Things to note
- Since the URL of the workflow initiation form is hardcoded, if you globally re-republish your workflow, you will need to update the TemplateID of the workflow.
Categories
Recent Posts
- Save document library as template option not available
- Short break
- Speed up SharePoint using the IIS Blobcache
- Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.No global profile is configured. Specify a profile name in the @profile_name parameter.
- Microsoft SharePoint is not supported with version 4.0.30319.296 of the Microsoft .Net Runtime.
Popular Posts
- SharePoint Keeps Prompting for Credentials Problem SharePoint keeps prompting you for credentials in the following scenarios: You ...
- Security Token Service Application- Broken Problem Had an issue today on one of my developer's VMs. ...
- User Profile Service Stuck on Starting Problem You have followed Harbar's Rational Guide to setting up the ...
- Event 8313 Topology – Load Balancer EndpointFailure – SearchService.svc Problem Encountered the following error while analysing the logs on our ...
- Event 6398 and 5586 SharePoint Foundation Problem Event logs were getting filled with the following errors: Event 5586, ...
- The security validation for this page is invalid Problem: After applying SharePoint 2010 Service Pack 1 and June 2011 ...
- The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered. Problem You install .NET Framework 4.0 on your SharePoint 2010 WFE ...
- Start a workflow using PowerShell Requirement Start a workflow on all / specific items in a ...
- Using Export-SPWeb to export libraries / lists This is a simple one but many people get the ...
- Unable to change User Profile Service Account Problem So you made a mistake by trying to change the ...
Tags
Backup and Restore Branding Content Management Content Organizer database Debugging Document Conversion Service DPM Event 7362 Expiration Policy IIS InfoPath Information Management Javascript KB2266203 Masterpage Migration Mysite OCS Office Page Layouts PowerPivot Powershell RBS Records Center Regional Settings Search Search Center Security Send-to Connection SharePoint Diagnostic Studio SharePoint Manager Solutions SPD Uploading Usage and Health Data Collection User Profile Service Visual Upgrade Web Analytics Web Content Management Webdav Webparts Workflow WSS XSLT



