Populating an Infopath dropdown using a specific Sharepoint list view
By peter.stilgoe
If you have a Sharepoint list containing multiple views, one view shows all approved items and another view shows all items that are pending approval. You have an Infopath form where you have a dropdown control that you want to be populated with only ‘Approved’ list items from your Sharepoint list.
If you create your Infopath data connection & copy the URL to this list view as your source you will notice it still returns ALL items as opposed to your filtered view listing only the approved items.
The way round this is to create you data connection using an XML source, use this link to find out how to view your list data as XML and get the source URL – http://www.petestilgoe.com/2009/11/converting-a-sharepoint-list-into-xml/
Now you need to expand on this & add the particular view to the url to make the data connection get the filtered data for you.
Currently your URL looks something like this:
/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&XMLDATA=TRUE&noredirect=true
1) Now in your Sharepoint list click ‘Settings’ –> ‘List Settings’
2) Scroll down to the bottom & click on the view you want to use as your datasource
3) Now your URL contains the {List GUID} as well as the {View GUID}
eg. /_vti_bin/owssvr.dll?Cmd=Display&List=%7BD66DCB51%2D80B0%2D43AB%2DB80B%2DCD7D23E63B09%7D&View=%7B6D0CEF69%2DF899%2D40D0%2D86B2%2D6E01CC7D9CA1%7D&XMLDATA=TRUE
4) The URL is encoded so you will need to replace “%7B” with “{” and “%7D” with “}” and “%2D” with “-” so now your url will look something like
/_vti_bin/owssvr.dll?Cmd=Display&List={D66DCB51-80B0-43AB-B80B-CD7D23E63B09}&View={6D0CEF69-F899-40D0-86B2-6E01CC7D9CA1}&XMLDATA=TRUE
5) Use this url as your XML data source in Infopath and your drop down data will be filtered as per your chosen view.
Making the Contact Selector mandatory in an InfoPath form
By peter.stilgoe
OOTB you cannot make the contact selector in a InfoPath form a mandatory field. However you can easily get round this by doing something like this.
- In my datasource I tend to create a hive called ‘Validation’ (This is where I hold or my extra fields I use to carry out my various validation routines)
- Create a field in here called something like ‘EmployeeName’ or whatever your preference but something logical / descriptive
- Now set this fields default value to equal the field you are actually using for your contact selector ie. EmployeeName = DisplayName
- Now as EmployeeName = DisplayName set a validation rule on ContactValidate so that it cannot be blank
Now your contact selector is a mandatory field.
How to autopopulate Infopath fields using Sharepoint list data
By peter.stilgoe
1) Get your Sharepoint list into XML format
2) Set up a data connection using the above XML file as your datasource
3) Now you need to configure rules and filters on your list box. Let’s say that your list box has customer name and you wish to fill a field with the customer phone. When you set your rule, you would first select Set a field’s value then select the field where you want the phone number.
4) To filter for the correct phone number, select the formula button next to the Value field. In the formula window, select Insert Field or Group.
5) Select your secondary data source and the phone number field. Select the Filter Data button. Select Add.
6) In the first drop down, select the customer name field from your secondary data source. Leave the middle one set to Is equal to. For the third drop down, select the field on your form that is bound to the control with the customer name in it.
At this point, what you are basically telling the rule is: Go get me a phone number. I want it to belong to the same customer as the one I just selected in my List Box.
If your datasource is fairly static, when creating the data connection for the XML file in the Data Connection Wizard, ensure that the option to Include the data as a resource file in the form template or template part is selected. This will enhance the speed of your data queries to your datasource significantly.
Steps taken from Hilary Stoupa over @ InfopathDev.com
InfoPath Contact Selector – Limitations & Workarounds – Part 1
By peter.stilgoe
The contact selector available in InfoPath is a very useful control but has some pretty big feature limitations which will hopefully be rectified in Sharepoint 2010 / InfoPath 2010 but I havent had time to check yet.
How to make the InfoPath contact selector mandatory – http://www.myriadtech.com.au/blog/Alana/Lists/Posts/Post.aspx?ID=16
Limit the number of names a user can enter into the InfoPath contact selector – http://www.myriadtech.com.au/blog/Alana/Lists/Posts/Post.aspx?ID=13
Using the InfoPath contact selector to get other users details eg Dept, Office, Manager etc from the User Profile Database – http://www.myriadtech.com.au/blog/Alana/Lists/Posts/Post.aspx?ID=15
How to auto populate InfoPath forms using the people picker
By peter.stilgoe
Step 1:Add the Contact Selector control to InfoPath – this only has to be done once within InfoPath, then it will be available for future forms.
1. From the Controls task pane, click on “Add or Remove Custom Controls…” then click Add.
2. Select “ActiveX Control” then click Next.
3. Locate “Contact Selector” in the list, select it, then click Next.
4. Ensure “Don’t install a .cab file” is selected, click Next.
5. Set the Binding Property to “Value”, click Next.
6. In the drop-down menu for field or group type, select “Field or Group (any data type)” then click Finish.
7. Click Close, click OK.
Step 2: Add a data connection – this must be done for each new form created.
There is some preliminary work here, first you have to create an XML file and save it. Open notepad and paste:
Use Form View when configuring session state for InfoPath Forms Services
By peter.stilgoe
You can configure InfoPath Forms Services to use the Session State Service (the default option) or Form View to control how user sessions are managed. When you configure InfoPath Forms Services to use the Session State Service, all browser sessions are maintained on the SQL Server database corresponding with the Shared Services Provider (SSP) associated with the Web application on which the form template is hosted. This scenario uses little network bandwidth, but has a cumulative performance impact on the computer running SQL Server. When you are using Form View, sessions are maintained on the client browser, and all session data is included in each postback to the server, up to 40 kilobytes of session data. This uses more bandwidth than using session state, but does not affect the computer running SQL Server. Once session data reaches 40 KB in size, the session automatically transitions to session-state management.
We recommend the use of Form View in environments that have smaller groups of users, because it reduces the impact on SQL Server. If your InfoPath Forms Services deployment will have many users, particularly if session data is below 40 KB for many high-usage form templates, session state is likely a better choice. If Form View is used, the bandwidth used by browser sessions of 40 KB or fewer can be monitored if there is a concern that network performance might be adversely affected.
Auto populate your InfoPath form with the current user name
By peter.stilgoe
You want to a user file in your InfoPath form to auto populate with the current user who is logged on, follow these steps:
1) Create a new form by Designing a New Form Template
2)Choose blank form
3) Add a text box to the form (Field1)
4) Go to Tools | Form Options
5) Go to the Open Behavior section and click on Rules
6) Add Action to Set a Field’s Value
7) Choose the field you added above as the field to populate
8 ) For the value, click on the Fx button and choose Insert Function
9) View All in the Categories drop down
10) At the bottom you’ll see userName, pick it
11) The formula that gets dropped in is userName()
12) Preview the form, you’ll see your UserName in field1



July 6th, 2010

![Recommend [pstilgoe]](http://s3.amazonaws.com/arkayne-media/img/badge/logo-recommend-badge-medium.png)