Pass query string to a SharePoint list’s “Add new item” form that was customized by InfoPath 2010

Scenario:

There is a list called “Customer Equipment” and its form was customized by InfoPath 2010. One of the field is called “Customer” which is a look-up field (a dropdown list).

When add a new item I want to pass the customer ID from the URL query string like this:

http://sharepoint.thedomainname.com.au/Lists/Customer%20Equipment/NewForm.aspx?theID=(a-customer-id)

and the customer with that ID in the “Customer” dropdown list will be automatically selected.

Step by step:

More Details: http://www.sharepointlearning.net.au/sharepoint_article_details.aspx?articleID=17&title=Pass%20query%20string%20to%20a%20SharePoint%20list%E2%80%99s%20%E2%80%9CAdd%20new%20item%E2%80%9D%20form%20that%20was%20customized%20by%20InfoPath%202010

Open the form in InfoPath and create a textbox in anywhere and change its name to “theID”. Then add two rules to this text box, one is to hide the text box and the other is to set the value of “Customer” dropdown list to this “theID” text box:

passquery1

Submit the form to SharePoint.

Go to “List Settings >> Advanced settings” and set “Launch forms in a dialog” to “No”.

Go back to the list and click “Add new item”, then click “Site Actions >> Edit page” then “Add a Web Part”, then add the “Query String (URL) Filter” web part under “Filters”:

passquery2

Open the “Open the tool pane” and put in the parameter name “theID” and click OK:

passquery3

Connect the filter to InfoPath form:

passquery4

passquery5

Close and get out of the “Edit Page” page and it’s done!

This entry was posted in InfoPath 2010, SharePoint 2010. Bookmark the permalink.

2 Responses to Pass query string to a SharePoint list’s “Add new item” form that was customized by InfoPath 2010

  1. duh says:

    localhost huh

Leave a reply to Lin Zhang Cancel reply