Sometimes you want your users to be able to open forms without having to navigate to SharePoint and open 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:
(Note: to open existing forms, you’re going to need to make sure you’re 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:
…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 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 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 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 bottom boxes checked.
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. You can open links from mobile devices and submit anonymously. 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 copied your link, 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!
About the Author
Jennifer holds a BS in Mathematics from Harvey Mudd College and a MS in Computer Science from Johns Hopkins University. She has several years of experience as a QA tester and programmer for the US Department of Defense, and most recently she was a systems engineering team lead at The Aerospace Corporation. Jennifer specializes in mobile form development for Qdabra.