REST and InfoPath

Megan Jackson

How to connect REST Web Service and InfoPath

When do you need a rest web service?

Situation:

Let’s say you have an InfoPath form that is gathering data for all the gas stations in your city. As we all know, there can be thousands of gas stations in one city.


At first, the developer set up a data connection to a SharePoint list for all the gas station information (name, address, ect.), but quickly realized the maximum record threshold of 5,000 was reached.


Say there are 8,000 gas stations, how does the developer of the form overcome this limitation?

Solution:

Create a REST Web service data connection and use parameters to narrow down your gas station data.
Here are the steps to create a REST Web Service data connection in InfoPath.

1. Start by creating a new REST Web Service data connection in InfoPath by opening the data connection wizard in the ribbon

2. Paste the URL of the REST Web Service (contact us to figure out how to create a REST web service for SharePoint 2013). SharePoint 2013 allows users to work directly with SharePoint objects (lists, libraries, etc.) by using any technology that supports standard REST capabilities.

3. After you have created your data connection you will need to create a field that limits the records returned from the REST Web Service. For example: search gas stations by zip code and a drop down which will list all the gas stations by zip code

4. After you have created your text box field, create an action rule “Change REST URL”. This will change the REST Web Service url to filter by the zip code you entered into the text box field

5. Once the Change REST URL action rule is created, add another action rule “Query using a data connection” and select the REST Web Service data connection that you created

6. After these two action rules are created on your zip code text box field, move to the drop down that will list the gas stations. Go into the properties and choose get data from external source. This will bring up the columns created in the REST Web Service. Examples of columns that may have been created in this example are: Gas Station, Address, City, State, and Zip Code. Choose zip code from the list

7. To test, go into preview mode. Type in a zip code in the zip code search text box. When you click out of the text box the action rules will set the parameters of the REST Web Service and then query the data. The drop down should only show the gas stations that are in the zip code

In conclusion, REST Web Services are a quick and easy way to avoid the 5,000 limit threshold in lists. Setting the parameters; say by a zip code, create a narrowed query, which in turn creates a better user experience. We have seen many clients run into the threshold issue and have turned to a REST Web Service to overcome the issue. This is a simple and successful method to bring back the necessary data for a form.

To learn more about Forms On Fire, our talented team or to start a free trialvisit our Company Page or ask a question using the form below!

The body content of your post goes here. To edit this text, click on it and delete this default text and start typing your own or paste your own from a different source.


By Megan Jackson | August 19th, 2015 | Office365


Share by: