Emailing Links to InfoPath Forms - Jennifer Lindsay
in

InfoPath Dev

Jennifer Lindsay

Emailing Links to InfoPath Forms

Sometimes you want your users to be able to open forms without having to navigate to SharePoint and open up the associated form library. Sometimes you want them to do it without even having to log into the SharePoint site: maybe your end users don’t even have SharePoint accounts! Today’s blog post will give you a few tips on how to accomplish these and other goals.

To give your end users the ability to open a form from outside the SharePoint library, you need to know the syntax of an InfoPath form link. Let’s look at a sample link in detail. Suppose you have SharePoint site called http://www.MyShPSite.com, with a sub-site called MySubsite, and an InfoPath form library called MyLibrary. There are many different query parameters for an InfoPath form link, most of them are optional so we’ll only cover the necessary ones--- XsnLocation and XmlLocation---in this post. (You can read more about the other query parameters here.)

New Form Link:

http://www.MyShPSite.com/MySubsite/_layouts/FormServer.aspx?XsnLocation=https://MyShPSite.com/MySubsite/MyLibrary/Forms/template.xsn

Existing Form Link:

http://www.MyShPSite.com/MySubsite/_layouts/FormServer.aspx?XmlLocation=/MySubsite/MyLibrary/MyFormName.xml

(Note: to open existing forms, you’re going to need to make sure you are using a unique naming convention for your forms! Otherwise if you have three forms all named 2016-12-25.xml, how will InfoPath know which form to open?)

Ok, now that you have your link, how do you get it to your users? Well, the easiest way is to send them an email with the link. To do this, you’ll need to download a nifty tool called SharePoint Designer – it exists in both 2010 and 2013 varieties, download the one for whichever flavor of SharePoint your site is running on.

Now that you have downloaded your designer tool, switch back to InfoPath. Whatever naming convention you’re using for your forms, store that value in a text field in your schema. I’d suggest calling this field FormName or something similar.

(Note: if you only want to send links to new forms, you can skip this FormName stuff and go straight to the FormLink part down below.)

Now add another text field called FormLink, and set the default value of that field to the following hardcoded value for a new form:
http://www.MyShPSite.com/MySubsite/_layouts/FormServer.aspx?XsnLocation=https://MyShPSite.com/MySubsite/MyLibrary/Forms/template.xsn

…or this formula for an existing form:

Now promote that FormLink field by going to File à Form Options à Property Promotion and adding FormLink to the list:

Republish your form to your form library, then open up your site in SharePoint Designer. (If you don’t have SharePoint Designer, you can download it for free here.) Navigate to the Workflows page then add a new List Workflow. Select the name of your form library, then name your workflow (mine is called Send Email).

Now you need to create the email template. In the WORKFLOW ribbon at the top of SharePoint Designer, select Action à Send an Email. Open up the Email Designer, select a recipient, type a subject heading and body text, then type the text you want to describe your form link. Highlight this text, then click the Hyperlink icon to bring up the Edit Hyperlink popup menu. Click the fx button on the Address line, then select the Form Link promoted property from the source field dropdown in the String Lookup popup window. Click OK to close out all of these windows.

 

We’re almost done: go back to the Workflow Settings page (Workflows à click the name of your workflow) and edit the Start Options. Select the checkboxes that correspond to your particular use case. In mine, I want the email workflow to run when a new form is submitted and when an existing form is resubmitted, so I have both of the bottom boxes checked.

 

And finally, make sure to Publish your workflow to your SharePoint site by clicking the Publish icon at the top left of SharePoint Designer.

That’s it! Now each time your workflow runs, and email will be sent with a link to your form (or to open a new form, if that’s the option you selected way back at the beginning of this tutorial).

 

Emailing Links to FormsViewer Forms

 

FormsViewer is a great alternative to InfoPath. Links can be opened on mobile devices and you have the option for anonymous opens. You can also send links to FormsViewer forms, but because those links are slightly longer you’ll need to make a few adjustments to the above process.

If you have FormsViewer installed on your SharePoint site, you can copy the link to open a new form by right-clicking on either the Open Form button or the Open Form (anonymous) button.

 

Once you have your link copied down somewhere, you will go through the same process described above to promote your Form Link field, with one special modification: you need to first create a Site Column on SharePoint, and then promote the Form Link field to that specific column.

Here is a tutorial on how to create a SharePoint site column (make sure the one you create allows multiple lines of text).

 

Once your site column is created, you will need to associate the FormLink field with that site column by re-publishing your form the long way (do NOT edit the Promoted Properties menu in InfoPath – that way won’t work!).  Go to File à Publish à SharePoint Server to bring up the Publishing Wizard, then Next-click your way through the wizard without changing anything until you get to the promoted columns list. Click the Add button, select your FormsViewer FormLink field from the list of schema fields in the popup window, then select the Custom Columns site column group, and select the name of the site column you created in the previous step (I named mine FormsViewer Link). Click OK, Next and then Publish.

 

The steps to create an email workflow are the same for FormsViewer, so that’s it for configuring an email workflow to send a link to open a FormsViewer form!

Comments

No Comments

About jscookster

Project Manager at Qdabra Software
Copyright © 2003-2017 Qdabra Software. All rights reserved.
View our Terms of Use.