SharePoint & InfoPath: No-Code for dependent forms in SharePoint lists

Did you ever should offer a solution for a customer and first thought of developing everything from scratch? It doesn’t matter if you’re a developer, a consultant or whatever.
You should be lazy, you should use what have been already developed and tested, you should be smart!

If you’re smart you just try to use standards & standard features as far as it will go and you try to offer a solution which fits the needs of your customer. But many people don’t know how far they can go with SharePoint. SharePoint has huge capabilities to offer solutions based on its out-of-the-box features which are almost in every company available.

In such a scenario we surprised a customer who thought he knows that his process is not manageable with the standard features of SharePoint and he was ready to pay for development of his tool based on SharePoint.

As you know a custom solution which needs to be deployed on a big SharePoint farm needs

  • to be developed,
  • a user requirement,
  • a functional description,
  • a testing script,
  • needs a higher budget

and of course you have to check the performance. What happens if you want to upgrade to SharePoint 2013? Would it still works? Do you need to redevelop it?

To cut a long story short let me only describe one enabler for surprising the customer. One of the most important requests to this solution was the usage of dependent forms in a SharePoint list, so called cascading dropdown lists. In the upcoming lines you’ll get a step by step explanation how we did it by using the standard features of SharePoint. I’d like to highlight a post written by Marcel Meth which helped us (Link to article).

Let’s starting with a small imaginery story. You like to have a SharePoint list in which you can request a room for a meeting. You use therefore a nice form which has entry forms for title, date, location, room no. and the amount of attendees. The choice of the room no. should be dependent on what location you choose.

Step 1: Create a list for room numbers and city

  • Create a new list and call it “rooms”
  • Create a new column for the city and call the title column “Room”
  • Create some entries for this list

Step 2: Create your RoomRequestor list

Well, the first list is ready. Now, let’s using some other features of SharePoint Enterprise Edition.

  1. Create a custom list and call it “RoomRequestor”. Go to the ribbon tab “list” and choose “Customize Form”

    Now the InfoPath 2010 Client opens the form for this list.

  2. Add a receive Connection to the list “Rooms”
    1. Click on Manage Data Connections…
    2. Click on Add
    3. Click on Receive data and on Next
    4. Click SharePoint Library or list and then on Next
    5. Provide the url of the “Rooms” list and click on Next
    6. Choose the “Rooms” list and click on Next
    7. Check off “Rooms” and “City” and click on Next
    8. Always click on Next till you finished

    Screenshot-Wall for these steps:

As you can see, we didn’t use source code.

  1. Create the fields on the form
    1. A date-field for the date
    2. A dropdown-list for city
    3. A dropdown-list for rooms
    4. A Textfield for the sum of attendees

Now the really interesting part begins. We are going to develop the cascading dropdown-lists. At first we have to fill the dropdown-list for the city.

Step 3: Creating the dropdown-lists with dependencies

Click on the form field for “city” and go to properties. Choose at List Box Choices the “Get choices from external data source” and use your data connection “Rooms” we created earlier this morning. You set as values and display name the column City.

After Clicking on OK, you can see already the first result.

Well, let’s go on filling the second dropdown-list. Therefore you should reopen the entry form in the InfoPath Designer by using the button “Customize Form”.

Now we are going to set the field “rooms” – open the properties. Just do the following:

  1. Choose “Get Choices from an external data sources”
  2. Pick the “Rooms” list as data source
  3. Click on the button next to the entries

  4. Click then on Filter Data

    We are now filtering the data for the values choosen from form field city.

    1. Add filter

    2. After this select “Field or Group…” and select the primary data source…

    3. In the primary data source you choose the data field “City”. Why? You only want to show the rooms of the selected city, there you set the filter.

    4. Now you have to click OK or Next to close all the opened windows.

    Now the second dropdown-list is filled only with rooms which are located in the selected city from the first dropdown-list. We have to do one more step. This step makes the form better, so please read on.

Step 4: Create a rule for the City-field

You create this rule because you want to have a really nice form. If you don’t set the rule, the dropdown field for “Room” will not update in that moment in which you change the city. But we would like to present a solution which meets the business needs and the user expectation.

  1. Mark the field “City”
  2. Click on “Manage Rules” and then add a new rule

    The rule takes action if the field is changed

  3. Click on Add Action and choose to change the value of a field
  4. Now you choose the field “Room” and leave value empty.

What do you think what now happens? Exactly, if you change the city, the room field gets empty.

Step 5: Look at your solution and thank God it’s cool to work with SharePoint

We did not use any code and the solution works with the standard features of SharePoint 2010. You just click, use some features and you’re ready.

I like these simple and smart solutions which are possible with SharePoint and InfoPath.

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.