How to create a SharePoint Designer workflow that sends an email with a link to an InfoPath browser form

Learn how you can create a SharePoint workflow that is run whenever a new InfoPath web-based form is submitted to a SharePoint form library and sends an email, which contains a link to open the InfoPath form in the browser.

ADVERTISEMENTS

Problem

You want to be able to send an email to one or more users when an InfoPath form is submitted to a SharePoint form library. You also want to include a link to the form that was submitted, so that users can click and open the form in a browser.

Solution

Create a custom SharePoint workflow that sends out an email when an InfoPath web-based form is submitted to a SharePoint form library.

Note that if your company does not allow the use of SharePoint Designer, an alternative method would be to use an email submit data connection to send an email and then extend that solution to be able to send an email with a link to the InfoPath form on submit without having the need to use a workflow or write code.

Discussion

You can create a SharePoint workflow that sends an email with a link to an InfoPath form as follows:

  1. In InfoPath, create a browser-compatible form template and publish it to a SharePoint form library.
  2. In SharePoint, configure the SharePoint form library to display InfoPath forms as a web page.
  3. In SharePoint Designer, on the File menu, click Open Site, and open the SharePoint site where the SharePoint form library resides.
  4. On the File menu, select New, and then click Workflow.
  5. On the Workflow Designer, type a name for your SharePoint workflow, select the form library that contains your InfoPath forms as the SharePoint list to attach the SharePoint workflow to, deselect Allow this workflow to be manually started from an item, select Automatically start this workflow when a new item is created, and click Next.
  6. On the Workflow Designer, click Actions, and then select Send an Email from the context menu that appears. This will add the action

    Email this message

    to the actions for Step 1.

  7. Click this message in the Email this message action.
  8. On the Define E-mail Message dialog box, enter one or more valid email addresses in the To field, and enter a subject in the Subject field.
  9. In SharePoint, go to the form library where your InfoPath forms are stored, and click an existing InfoPath form to open it in the browser.
  10. Copy the URL of the InfoPath form. The URL could resemble the following:

    http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=/SiteName/LibraryName/Form1.xml&Source=http%3A%2F%2FServerName%2FSiteName%2FLibraryName%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1

    where ServerName is the name of the SharePoint server, SiteName is the name of the SharePoint site, LibraryName is the name of the SharePoint form library, and Form1.xml is the name of an InfoPath form.

  11. In SharePoint Designer on the Define E-mail Message dialog box, paste the URL in the email's body field.
  12. Highlight the URL for the InfoPath form that comes after the XmlLocation parameter,

    /SiteName/LibraryName/Form1.xml

    in this case, and click Add Lookup to Body.

  13. On the Define Workflow Lookup dialog box, select Server Relative URL from the Field drop-down list box, and click OK. The final link should now resemble:

    http://ServerName/SiteName/_layouts/FormServer.aspx?XmlLocation=[%LibraryName:Server Relative URL%]&Source=http%3A%2F%2FServerName%2FSiteName%2FLibraryName%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1

  14. On the Define E-mail Message dialog box, click OK
  15. On the Workflow Designer, click Finish.

Now whenever you create a new InfoPath form and save it to the form library, the SharePoint Designer workflow is started, and an email is sent to the recipients you specified for the email in the SharePoint workflow. When a user opens the email and clicks on the link in the email, the InfoPath form opens in the browser.

Also See

Recipe 77 of InfoPath 2010 Cookbook 2 shows you how you can specify a list of recipients to send an email to when a SharePoint Designer workflow is manually started, and then send an email with a link to the InfoPath form to those email recipients. And the discussion section of that recipe explains and expands on how to construct the link so that the InfoPath form can be opened in the browser.

 


Related InfoPath Articles:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services