InfoPath– Formulate Email Link to Browser Form


When using InfoPath 2010 with SharePoint, it is common to create workflows to send a link to the form.  The most common thing in my experience is an approval process.  Each time the form needs to be approved, the next approver is sent an email via SharePoint Designer workflow.  There is a “URL Path” field that can be used in the email, which will directly open the form.  The problem with this method is that there is no way to control *how* the form is opened.  If the end user has the InfoPath client software on their computer, clicking this link will open the form in InfoPath…. even if it is a browser based form and you want it to always be opened in the browser.

Why would you care if the form gets opened in the client or the browser?

  • One main reason is to keep a consistent user experience.  If they get a browser form every time they open the form, then they will be less likely to be confused about why the form looks a little bit different.
  • Another, more obscure reason, is the timing issue with workflows.  When I have a workflow that runs when a form is changed, sometimes if the client software is used, the software just isn’t quite finished closing when the workflow kicks off, so you get conflicts and errors.  If the form is always opened in the browser, this will never happen.

Here’s how to formulate the URL.  First, click an existing browser-based form, to dissect the URL.  This is just an example of what the syntax will look like.


The Parameters

XmlLocation – This is the path to the the specific XML file, which is a form that has been filled out.

ClientInstalled – It says that the client is installed on my computer, but this parameter is not important in this situation.

Source – This is important.  This is the URL where you want the person to be redirected to after they submit or close the form.  By default it is the default view of the form library, but you can use any site in the site collection.

DefaultItemOpen – This tells it to open the form in the browser.

The Workflow Email Hyperlink

If you’re like me, you like to send a link to the form in several different emails, at different times in the workflow.  For efficiency’s sake, I like to create the link as a workflow variable, so that it can simply be reused in several places.  Here’s how:

  1. In your SharePoint Designer workflow, add a new action to “Set Workflow Variable” at the very beginning of the workflow.
  2. Click the blue text workflow variable, and choose Create a new variable.  Name it FormLink, and make it a string.  Click OK.
  3. Click the blue text value, and click the little ellipses (string builder)
  4. Click the Add or Change Lookup button.  Choose Workflow Context as the data source, and choose Current Site URL as the field.  Click OK.
  5. After you select the Current Site URL, type the following text after it.  (see screenshot) You are basically re-creating the same structure as that original URL that you copied.
  6. Put the cursor at the very end, and then use the Add or Change Lookup button again, this time selecting the Workflow Context and the Current ITEM URL (not current site again).
  7. Go ahead and recreate this entire string, as one big string with no spaces, there’s one more spot where you insert the “current site URL”.  Click OK.
    ch5[191]NOTE: In most situations, I want the end user to be redirected back to the home page after they submit or close the form, which is why I use “Current Site URL” in the &Source section.  This is up to you, and can be some other site or page in your site collection.
  8. This is what the set variable action will look like:
  9. At any point in your workflow where emails are being sent, this variable can be used.  In the body of your email, click Add or Change Lookup.  Pick Workflow Variables and Parameters as your data source, and then pick the FormLink variable.

This method can be used in either list-based or reusable workflows.  Stay tuned for more posts regarding hyperlinks in workflows and the task process designer.


Leave a Reply