Variety is the spice of life. If you could see the tea and coffee collection in the Bamboo kitchen, you'd probably agree that we take that to heart around here. Following in the fine example of Bamboo's 14 flavors of coffee, 49 varieties of tea, and 70 products, part two in this week's four part Workflow Conductor use case about an InfoPath survey will cover a selection of InfoPath form fields and configuration options.
You might recall from part one in our series (My First InfoPath Form) that our fictitious company, Widget Corp, is soliciting feedback from its customers. An independent survey company records survey results in an InfoPath form on Widget Corp's SharePoint site, and management wants to be notified immediately of any "bad" survey results.
In yesterday's post, we set up the SharePoint lists and libraries we'll be using for this scenario, and we started creating an InfoPath survey form. Hopefully you had some time to play with the InfoPath design features, and now have a form that looks something like this:
Today we'll be configuring the form controls so that our survey has a few key features:
- A drop-down list box with values from a SharePoint containing customer names.
- A drop-down list with a manually entered-entered list of values to track the reason for the call.
- A text box that we'll hide or unhide, depending on the reason for the call, to gather more information.
- Option buttons that will rate the customer's experience.
- Certain fields will be required.
To configure the properties for each control, double-click on it. Let's get started:
"Customer" Drop-Down List Box
Since we want don't want to have to rely on the creative spelling abilities of our survey company reps, it's probably a good idea to give them a list of Widget Corp customers to choose from. Fortunately, Widget Corp stores all its customers in a SharePoint list called Customers (which you created earlier). All we have to do now is tell InfoPath where the list is, and which field contains the choices we want to display.
There's an InfoPath wizard to make this task an easy one. To start the wizard, double-click on the drop-down list box control next to the "Customer" label in your survey form to display its properties. In the Drop-Down List Properties box, click Look up values from an external data source in the List box entries section, and then click the Add button:
Walk through the wizard to add a connection to the Customers list in your SharePoint site:
- Select the option Create a new connection to: Receive data, and click Next.
- Select SharePoint library or list as the source of your data, and click Next.
- Type the name of the SharePoint site where your Customers list is, and click Next.
- Select the Customers list from the available lists and libraries, and click Next.
- The only field we need here is the Customer Name field, so make sure at least that one is checked, and click Next.
- You do not need to store a copy of the data in the form template, since the Customers list may change often, so leave that option unchecked and click Next.
- Enter a name for the data connection (the default of Customers is fine). We want the Customers drop-down list to populate when the form is opened, so leave that option checked and click Finish.
You're now back in the Drop-Down List Box Properties box, with the Customers data source selected. Now we just need to pick which field in the list to display in this control. Click the Select XPath button () next to the Entries field and expand the field list until you see the :Customer_Name field. Select it and click OK.
Finally, let's change the field name to something that makes more sense, like CustomerName (no spaces allowed), and make it required by checking the Cannot be blank check box in the Validation and Rules section. When you're finished, click OK.
Want to see if it works? Click the Preview button in the InfoPath toolbar. This will launch a preview of your form so you can test it out.
"Reason for Calling" Drop-Down List Box
Widget Corp wants to know why the customer was calling, so this drop-down list will just be a manually-entered list of reasons. InfoPath list box entries can have display names that are different from their actual stored values, and we're going to take advantage of this to link a call reason to a department in the Departments list you created earlier. This will allow us to fine-tune our "bad" survey notifications and send them only to the department that handled the call the survey is about (we'll do this with our workflow, in part four).
Double-click the second drop-down list box in the survey form to display its properties. Make sure the option to Enter list box entries manually is selected in the List box entries section, and click Add to start adding call reasons. Enter as many as you want, just make sure each Value corresponds to one of the department names in the Departments list. For your last reason, enter something with a value of Other ("Other" doesn't have to be in the Departments list).
Last but not least, rename the field (I used ContactReason), and make it required.
Hidden Text Box
For the "Other" call reason, Widget Corp wants the survey company reps to manually enter whatever the customer tells them into a text box in the survey form, which we've added just below the ContactReason drop-down list box. We don't care about this information unless the call reason isn't one of the ones in the list, and we don't want extra information in our surveys. So let's configure the Text Box below the ContactReason drop-down box to be hidden unless we need it:
- In the Display tab of the Text Box Properties box, click the Conditional Formatting button at the bottom.
- Click the Add button to start adding a condition.
- In the condition builder, select ContactReason in the first drop-down. Select is not equal to in the condition drop-down. Select Type text… in the third drop-down, which will enable text entry in that box, and type Other.
- Check the box to Hide this control, and click OK. The text box will now be hidden unless someone selects a Reason for Calling of "Other".
Click OK to return to the Text Box Properties box, and click the Data tab. Rename the field (e.g., OtherDetails), and click OK.
If you preview your form, you'll see that the text box is hidden by default. Select a Reason for Calling of "Other", and the text box will appear.
Finally, the most important part of our form: the actual survey. Each group of option buttons that you added to the form is actually a single field group. Double-click on any option button in the group to configure it. We're going to keep things pretty basic, so just rename each option button group to something that represents the question. I named them Quality, Promptness, and Personnel.
I also decided to rearrange my buttons and remove the default label text for them, since I have a table with column headers describing each choice. Leave the first button in the group in the Not at All column. Move the 2nd button to the Somewhat column. Move the 3rd button to the Yes column. How do you know which button is "1st", "2nd", or "3rd"? Double-click on it and look at the Value when selected. We want low numbers to mean bad ratings, so arrange the buttons accordingly.
This will leave the label text just hanging out in the table. Go ahead and delete it. Your survey should now look something like this:
The design of the survey form is now complete. Don't forget to save your hard work! Hopefully the "InfoPath Intimidation" factor is much lower now, and your head is full of all kinds of ideas for fabulous new form functionality. Now that you know the basics, feel free to play around with the other InfoPath controls and configuration options.
In Part 3: Publish or Perish…Submitting an InfoPath Form to SharePoint, I'll walk you through publishing the form and configuring it so users can submit completed surveys. I'm off to peruse the Bamboo caffeine selection. While you're waiting, make sure you've downloaded and installed your free 30-day trial of Workflow Conductor – you'll need it soon!