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!
Have you some downloadable examples some I can restore into my environment?
I don't understand clearly how connect web part to new-edit-display forms.
What happens when I click on Edit button?
How do I filter on multiple values? I added two Query String (URL) Filters, however when I try to attach my second filter to the InfoPath Form Web Part, the option is greyed out with a tool tip of: all compatible connection types to the InfoPath Form Web Part are in use.
This work great, thanks.
However, I would also like to redirect to a different page after submitting the form. Normally I would use the Source parameter, but this doesn't work with the InfoPath form web part. Do you have any suggestions?
So this is an awesome feature, thanks for sharing.
Now, how do we take it to the next step and make it work with multiple values for multiple fields?
I'm hoping to be able to do this on our current site before the release of SP 15.
Too bad it doesn't work for lookup fields.
Is there a way to use more than 1 query string?
Using your example;
Going to the url site.com/page.aspx ... would put "email" into the Referrer box and "Very Satisfied" would go into the Overal Rating box.
I can add one Query String box, but Sharepoint (that includes Sharepoint Designer) won't allow for more than one query string filter box.
This is great help.. I almost gave up on a master/detail form without this trick. Thanks Daniel.
Do you have a manual or all-inclusive PDF for Infopath help ?
How to send two or more values using query string to the Infopath forms ?
Passing two different values using Query Strings URL Webpart is possible ???
Nice one Mike G. This now works a treat as I was having the same problem as Riccardo!! So much easier than putting in code!! :)
Can you use the query filter to change the view? I have ?view=partner which I've tried setting up to a text field that is hidden and having the form change on load but it doesn't work. (I think the onload is going before the field is changed.) Is there another way to do this?
Buenas tardes,a que se refiere con el referente?
This is a great article! I was able to get the procedure to work using a web part page, but when I created an aspx page in SharePoint Designer, add followed the same steps, I get an error message in the browser.
Is there a reason that this procedure only works for web part pages, or is there another step that needs to be accomplished for aspx pages?
i need to paramaeter for infopath form.how can i add two queryfilter for single infopath webpart
I found a solution to the limitation of passing one value. If you want to pass multiple value, you can format these values as "value1,value2,value3,value4,etc" and then running a rule on that field to read each values and populating relevant fields.