Blog Home  Home Feed your aggregator (RSS 2.0)  
.Net Jonesie - InfoPath - Setting Parameters on Web Service Calls when a form loads
A simple programmers blog
 
# Tuesday, November 06, 2007

I'm not a very good googler.  Others in the office seem to find the right answer quickly when I can spend an hour searching and not finding what I want. Today I spend 2 hours trying to solve this problem.

When you have a secondary data source that uses a web service, InfoPath lets you specify the input parameters.

image

You can set the value here to any simple data type.  However, it's not immediately apparent how you would set the value to a variable data item.  In this case I wanted to fetch some data for the currently logged in user.  This data is then used to pre-populate the form.

InfoPath has a username() function.  To use this to specify the value to the web service you need to create a rule for the Form.

image

  1. Select Tools/Form Options.
  2. Select Open and Save.
  3. Click Rules.
  4. Add a new rule.
  5. Add an action to set a field value.
  6. For the field, select your web service as the data source and the input parameter you want to set.
  7. Set the value to a function or some other calculated value.
  8. Add more actions if you have more input parameters.
  9. Add a final rule to submit the query for the web service.

Ensure that the data connection for the web service has the "Automatically retrieve data when form is opened" option turned off.

The complete instructions for this were located here.

Tuesday, November 06, 2007 3:42:19 PM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]   General | Sharepoint  | 
Comments are closed.
Copyright © 2012 Peter G Jones. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: