Hi there, Daniel Broekman here. After showing you how to customize a SharePoint list with InfoPath 2010, and describing the differences between SharePoint list forms and form library forms together with Kate Everitt, I’m back with a quick tip for easily sending a value from the browser’s query string into an InfoPath form.
Imagine one of the following scenarios:
In InfoPath 2007, you could accomplish these scenarios with code. With InfoPath 2010 and SharePoint 2010, there is a much easier way to send data from the query string into an InfoPath form. Let’s take a look.
Using a web part page and a part-to-part connection between a Query String (URL) Filter web part and an InfoPath Form Web Part (new in SharePoint 2010), we can easily pass a value from the browser’s query string into the form.
I’m going to assume you already have a list form published to SharePoint. I just created a simple form to collect feedback on a conference presentation. As you can see, I included a “Referrer” field that will track the referral source of users filling out my form.
To set up the rest of the scenario, follow these steps:
Everything should be set up correctly now. Save your changes to this page, and then navigate to the page. You should see the blank form.
To test that everything is working correctly, add “?Referrer=email” to the end of the URL, and you should see the Referrer field being populated with the value “email”.
That’s it! You now have a page that passes data from the query string into an InfoPath form, set up in less than 5 minutes, and without any code.
For more advanced scenarios, you can use this as a starting point. For example, you could have a rule on the “Referrer” field that performs certain actions based on the incoming value, such as querying a secondary data source, loading a specific item, etc. In the “customer invoice” example I gave at the beginning of this post, you could have an “onchange” rule on the “Customer” field that queries a secondary data connection for all of that customer’s invoices.
One final note: the InfoPath Form Web Part only supports one incoming part-to-part connection at a time, which means that you are limited to passing one value into the form using this method.
Please leave a comment to let me know how you’re using this functionality in your forms!
It is a good tips. It is exactly what I was looking for.
Thanks Matthieu! We're glad you found this post helpful.
This is not working for me in my situation. I had already created the scenario you outline above; but I am trying to display a list item in the InfoPath form; therefore I am passing the ID from the URL to the connected InfoPath Form - this is not returning anything. Am I missing something?
Many of the articles in this blog seem to be describing information that should be included in the Help files. I am getting very frustrated with the new approach of having info in blogs instead of Help. I click on the ? symbol, the office site opens, instead of Context Specific Help (Like we used to get) and then there is NOTHING on the topic. I then have to do an internet search to get basic info. How come MS changed from something that worked? Please reconsider this change and start putting the fundamental info about the product in the Help files (where it belongs) Thanks
The authoring of InfoPath 2010 Help topics is currently in progress and articles are being published on an ongoing basis. You can expect to see 4-5 new help articles per month until the end of October.
In response to Andrew Carter's question:
To get the InfoPath web part to load the form for a specific item, you’ll need to use a rule in the form that runs when the value of the connected field changes. The rule needs to set a query field value and run a query on the main data connection. For more detail, check out this post: blogs.msdn.com/.../sharepoint-list-data-connections-in-infopath-2010.aspx
This is goos. But it does not work in a Repeating Section or a Table. It only sets the first node and not the rest. There is no way to use preceding sibling to pass on the value to other section. Please let us know if there is a workaround, I have a very critical requirement. Thanks
How can i choose the view item views in the infopath form web part?When i use the infopath form web part,I couldn't find the view item and new item;
I.E Accept an ID in the form load even then query the data manually and populate all the fields. Then you could still have drop down fields communicate with other external lists.
Hello, thanks for this, I was wondering whether this was possible.
I am getting the message "the consumer web part did not provide schema information" when I try to connect the URL web part to the InfoPath form.
Same as Shehab's comment... I was using a Sharepoint Library form and when I tried to connect the querystring filter webpart with the Infopath form webpart I got the error message: "the consumer web part did not provide schema information". Any ideas why?!
Gorjan, Make sure that the field you want to connect is listed as "available as SharePoint Web Part connection parameters" in the publishing wizard.
Thank you for the tip. Is it possible to make this works also in a repeating section?
Not sure I understand how the value of "Referrer" or "Customer" is getting in the form.
Do I just add a data item named "Referrer" and/or "customer" type string