Fun with InfoPath: Dynamically Populate a List by Using a Webservice with a Parameter

Some time ago I started to explore InfoPath, so far it was a pleasant journey. Everbody (including myself) seems to be requesting an user-control version of InfoPath so you can have InfoPath forms in your own Smart Client applications. This would be really great, top of the bill would be integration in Visual Studio.NET, but maybe that's a little bit too wishfull-thinking. Another nice feature would be a free version of InfoPath, without the functionality to create and edit forms. Like there is a free Acrobat Reader and a commercial Acrobat Writer. Microsoft says it's hearing these requests, but has anyone already an idea if these features will be available?

Anyway, InfoPath is great when you walk between the lines. As soon as you step out of these lines, it becomes a little bit dirty, especially if it involves scripting (VBScript and JScript). That's right, it's a pitty that you can not use managed code (e.g. VB.NET or C#) in InfoPath (add this feature to the whish list!). What I wanted to accomplish was a form with a dropdown list of customer names, which could be submitted as a part of an invoice (for example). Filling a listbox with customer data is pretty simple using secondary data sources: you can have a webservice as the data source of the dropdown list. But what I wanted to have was an additional textbox in which you could specify a part of the name of the customer, so only a subset of customers would be listed (avoiding fetching a lot of data and improving the user experience: shorter list). Thanks to Joel Alley (Msft Developer Support) I found following KB Article, which is almost exactly what I was looking for:

Microsoft Knowledge Base Article - 826994
How To: Dynamically Populate a Drop-Down List Box by Using a Web Service
SUMMARY
The Microsoft Office InfoPath 2003 user interface does not permit you to specify a value in an input field and then have that value passed to a Web service that will in turn populate a drop-down list box with the results that match the value in the input field. This article describes how to call a Web service to dynamically populate a drop-down list box that is based on the selection in a second drop-down list box.

8 Comments

Comments have been disabled for this content.