41
InfoPath 2010 Help Articles This document contains articles from the Microsoft help site that we think are most useful for Formotus customers getting started with InfoPath 2010. Some articles have been edited to remove topics that to not pertain to Formotus forms. Additional Microsoft content can be found at http://office.microsoft.com/en-us/infopath-help . Articles in this document: Introduction to controls Introduction to rules Add, delete, and switch views (pages) in a form Publish a form Data connections overview Tips and tricks for making form filling faster 1

Articles in this document: - Formotus Help Center · Web viewWhen filling out a form, users can add or delete rows in a repeating table as necessary. Repeating tables can contain

Embed Size (px)

Citation preview

InfoPath 2010 Help ArticlesThis document contains articles from the Microsoft help site that we think are most useful for Formotus customers getting started with InfoPath 2010. Some articles have been edited to remove topics that to not pertain to Formotus forms.

Additional Microsoft content can be found at http://office.microsoft.com/en-us/infopath-help.

Articles in this document:

Introduction to controls

Introduction to rules

Add, delete, and switch views (pages) in a form

Publish a form

Data connections overview

Tips and tricks for making form filling faster

1

Introduction to ControlsLink to original article

When creating a form, you can add controls, such as text boxes, lists, or check boxes, to either collect or display information to users. In addition to more simple, familiar controls, such as text boxes and option buttons, Microsoft InfoPath 2010 includes a number of more advanced controls, such as repeating tables, choice groups, and optional sections. These types of controls let you design a more complex form template providing greater flexibility in your form design. For example, in an expense report form template, a repeating table allows users to add a row for each expense item that they need to submit.

Information that users enter into a control is saved in the form. When designing a form template, insert controls from the Home tab, by using commands in the Controls group. Alternately, you can drag fields or groups from the Fields task pane onto the form template. A control based on the field type is inserted.

In this article:

Controls and fieldso Insert a control into a new, blank form templateo Insert a control into a template based on a pre-existing fieldo Remove a control from a form templateo Change a control on a form template

Types of controlso Inputo Objectso Containers

Compatibility considerations

Controls and fields

In InfoPath, fields and controls are not the same thing. Fields are located in the Fields task pane and represent where the data that is being gathered is saved in the form. This data is stored as XML and can be used outside of InfoPath.

Together, the type of control and its associated field determine the type of information that users can enter into the control, as well as how users can enter that information. For example, if you have a date picker control on your form template that is bound to a field with a date data type, then users can enter only dates in that control. If a user tries to enter anything other than a valid date, such as their name or address, a data validation error appears on the control.

The following example shows a simple employee data form with three controls that are bound to three corresponding fields in the Fields task pane. The First Name control is bound to the

2

firstName field, the Last Name control is bound to the lastName field, and the Employee ID control is bound to the employeeID field.

If a control is not bound to a field, such as if the field is deleted or if it is bound incorrectly, then the information that is entered into that control cannot be saved properly.

Multiple controls of any type can also be associated to one field. This is useful when you have one view to enter and modify data and another view that is read-only for display purposes. For example, a user can pick a value from a drop-down list box control and then that value appears in a read-only text box on another view. Since both controls are bound to the same field, they both show the same data that was picked by the user in the drop-down list box control.

Insert a control into a new, blank form template

To add a control to an InfoPath form template, click where you want the control to be added and then, from the Home tab, in the Controls group, click the control that you want to insert. When doing this, it is automatically associated — bound to — a new field in the form template data source as it is added. Fields are shown in the Fields task pane.

3

 Note    To add controls to your form without automatically creating a corresponding field, on the Home tab, in the Controls group, click the Controls Pane Dialog Box Launcher to open the Controls task pane, and then clear the Automatically create data source check box. You can bind the control to a field later.

When you add a control to your form template this way, InfoPath inserts the type of control most frequently associated with the field data type. If this is not control type you want, it can be changed. Alternatively, click where you want to insert the control, right-click the field in the Fields task pane, and then select the type of control that you want to bind to the field.

Remove a control from a form template

To remove a control from a form template, select the control, and then press DELETE. When you remove a control, the field that is bound to that control remains in the data source. Data that is saved or retrieved in this field is not, however, shown to a user. To display any data that is bound to this field, you must bind it to another control. If, however, you do not want to use the field, you can delete the field by right-clicking it and then clicking Delete.

Change a control on a form template

Sometimes, you might need to change the type of a control, depending on the information that you are trying to collect. Likewise, InfoPath might automatically choose the wrong control type when adding a control that is based on an existing field. To fix this, change the control to another control type. Right-click the control, move the cursor over Change Control, and then click the desired control type.

4

5

Types of controls

The Controls task pane contains controls that you can add to your form template. The following tables describe the purpose of each control. These tables have been edited to include only Formotus supported controls.

Input

Input controls include the controls that you typically associate with collecting and displaying information.

Control Icon Description

Text Box

The most commonly used control on a form. Users enter any type of unformatted text into a text box, such as sentences, names, numbers, dates, and times. Text boxes cannot contain formatted text.

Rich Text Box

Can contain formatted text, including bold and italic text, and a variety of fonts, font sizes, and font colors. In addition, users can insert images, lists, and tables into a rich text box.

Drop-Down List Box

Presents users with an expandable list of choices in a box. The choices can come from a list that you create manually, from values in the form data source, or from values that come from a data connection to an XML document, database, Web service, or SharePoint library or list.

Check BoxAllows users to set yes/no or true/false values by selecting or clearing a check box.

Option Button

Lets users select from a set of mutually exclusive choices. A group of option buttons is bound to one field in the data source, and each option button saves a different value in that field.

Date PickerContains a box where users can type dates and a button that displays a calendar which allows users to select a date.

Person/Group Picker

Allows users to type or select a user from a SharePoint list. Users can search through the directory for a user if they do not know the name of the person or group they want to enter.

External Item Picker

Allows users to type or select items from external systems through Business Connectivity Services.

6

Objects

Object controls include buttons, labels, and ways to insert attachments, pictures and hyperlinks when users fill out forms.

Control Icon Description

ButtonUsed to submit a form, switch views, or query a database. You can also associate a button with rules or custom code that runs when users click the button.

Picture Button

Similar to the Button control, you can select any picture to use as the button.

Calculated Value

Displays read-only text, displays the value of another control on the form, or creates formulas based on XPath expressions.

Picture

Allows users to insert a picture as part of the form. Picture controls can save the image in the form itself or point the picture to a URL or Web address (such as http://contoso.com) of an existing picture.

Hyperlink

Used to enter a URL. For example, a form template that displays information about a list of products can include hyperlinks to product information Web pages. Hyperlink controls can point to any Web server on either an intranet or the Internet.

7

Containers

Container controls help organize form design by allowing other controls to be placed inside them. They also provide a way to allow multiple instances of a set of controls (repeating) or to allow the controls to be optional.

Control Icon Description

SectionContainer for other controls. Sections can include any of the controls from the Controls gallery.

Optional Section

Container for other controls and is useful for including extra information that is not necessary for all users to fill out. When filling out a form that includes an optional section, users can choose whether to include the optional section or not.

Repeating Section

Container for other controls and is useful for presenting repeating data, such as employee database records. When filling out the form that includes a repeating section, users can add additional occurrences of the repeating section.

Repeating Table

Displays repeating information in a tabular structure. Each item appears in a new row in the repeating table. When filling out a form, users can add or delete rows in a repeating table as necessary. Repeating tables can contain other controls.

Compatibility considerations

Some controls work only in Filler forms, while others work in both Filler and Web browser forms. Additionally, some controls may work in an InfoPath 2010 Web browser form, but not work if you are working on an InfoPath 2007 Web browser form. In order to minimize the chances of using an incompatible control on a form, InfoPath naturally displays only the compatible controls to a user, based on the type of form that they are designing. To see the control compatibility information, refer to the Controls compatibility section of InfoPath 2010 features that are not available in InfoPath Forms Services.

8

Introduction to rulesLink to original article.

Rules allow you to control the behavior of a form by performing actions that take place based on conditions within the form, or events that take place when filling out a form. The behavior that you can control by using rules in a form includes automatically displaying a message inside of a dialog box, setting a field value, querying or submitting data to SharePoint or a database, or switching views. These rules can be triggered by the user changing the value in a control, clicking a button, or opening or submitting the form. They can also be triggered based on conditions that are present when the form is opened, such as the user role or based on a value that is queried from a data source.

In this article

Types of rules

Create rules

Manage rules that are applied to controls

Set rules for opening or submitting the form

Rule Inspector (view all rules in a form template)

Types of rulesThe following three types of rules are available:

Validation Validation rules are used to indicate an error when the user enters an invalid value into a control. For example, a validation rule on a text box can confirm that a user enters a valid e-mail address. For more information regarding validation rules, see Add rules for data validation.

Formatting Formatting rules are used to apply text formatting and background shading to controls when a condition has been met. They can also be used to hide or disable a control. For example, a formatting rule can hide or display follow-up questions based upon a user’s answer to a preceding question, instead of including instructions for the user to “skip to step X.” For more information regarding formatting rules, see Add rules for conditional formatting.

Actions Actions are the most varied type of rule. Use these to switch views, set values in other fields, submit the form, or query for data. Actions are available depending on what you are trying to apply them to and whether you are building a browser form or an InfoPath Filler form.

9

For more information regarding rules that perform other actions, see Add rules for performing other actions.

Create rulesThere are two ways to add rules to your form. On Home or Control Properties tabs, in the Rules group, you can use either the Add Rule menu or click Manage Rules to open the Rules task pane.

On the Home tab, the Add Rule menu is the fastest and easiest way to add rules to your form. For example, it only takes four steps to add a rule to your form to validate dates.

1. Select the date picker control.

2. Click Add Rule.

3. Click Is in the Future.

4. Click Show Validation Error.

Now, when a user enters a date that is in the future, an error message appears. You can customize this automatically-created rule using the Rules task pane. For example, you can make changes to the ScreenTip box to give the user a more specific error message.

Manage rules that are applied to controlsAll rules are managed through the Rules task pane. Only the rules that are applied to the selected control appear. For example, if you have a text control with a rule applied to it that verifies user input is a valid e-mail address, only that rule appears in the Rules task pane when you select that text control.

10

You can use the Rules task pane to add, delete, or copy rules. For example, if your team gauges workload and risk on a sliding scale from 1 to 10, you can create a rule that flags a value of more than 7 by shading the field red, and then copy the rule to both the Team Workload and Team Risk fields on a form.

The following are some of the actions available from the Rules task pane:

To create a new rule, click New.

To delete a rule, select the rule, and then click Delete.

To copy a rule or all rules that are applied to a control, click Copy Rule or Copy All Rules.

To paste a rule that you have copied from another control, click Paste Rule.

Set rules for opening or submitting the formAdditional rules can be configured to run when the form is first loaded or when a user submits the form. To add form load or form submit rules, on the Data tab, in the Rules group, click either Form Load to set a rule that runs when the form is loaded or click Form Submit to set a rule for when the user submits the form. Clicking either Form Load or Form Submit changes what appears in the Rules task pane, in the same way selecting a control does. When you click Form Load, the rules that run when the form is loaded appear in the Rules task pane, where you can add or manage them as you require.

11

To enable the Form Submit button, do the following:

1. On the Data tab, in the Submit Form group, click Submit Options.

2. Select the Allow users to submit this form check box, and then click Perform custom action using Rules.

3. Click OK.

Important When the Rules task pane appears, create a new rule that runs when the form is submitted. If this is not done immediately, you must re-enable the Form Submit button. After a rule is added, the Form Submit button remains enabled, and then you can switch between different rule contexts.

Rule Inspector (view all rules in a form template)Use the Rule Inspector dialog box to view all rules and calculated default values that are in use on a form. To open the Rule Inspector dialog, on the Data tab, in the Rules group, click Rule Inspector.

The Rule Inspector dialog box displays fields that have rules associated with them and how these rules are related to other fields in the form template. This also helps you to determine if there is a problem with the rules on the form and to resolve problems.

Note The Rules Inspector dialog box doesn’t display formatting rules.

When you open the Rule Inspector dialog box, four types of rules appear:

Validation

Calculated Default Values

Actions

12

Programming

Within each of these sections, fields that have rules attached appear, in addition to the rules for each field. For each rule, conditions and corresponding actions appear.

If you click on a field, the Rule Inspector displays the rules that are associated with that field, either directly or indirectly, in the following categories:

Rules that depend on this field or group This category includes any rules that use the value in the field or group. For example, you can create a rule that runs when a user opens this form and the value in field1 is within a certain range.

Rules that are triggered by a change in this field or group This category includes any rules that are activated if the value in the field or group changes. For example, you can create a rule that adds seven days to a user-entered date and automatically displays the new date in another control.

Rules that may change this field or group This category includes any rules that can change the value of this field or group. For example, you can create a rule that sets the value of this field based on the value of another field in the form template.

13

Add, delete, and switch views (pages) in a formLink to original article.

By designing different views in your form, you can offer users different ways to look at data, either depending on the type of form that you want to create or the type of user that you are presenting the form to. For example, with multiple views you can:

Simplify a long, complex form, such as a lengthy survey, by splitting it into multiple pages that users can navigate through by clicking Next and Back buttons.

Show different versions of a form to different people based on their role in your organization, such as having policyholder, agent, and adjuster views when processing insurance claims.

Create a print-friendly view of your form.

All views in the same InfoPath form share the same data. As a result, if a form has two views and one of them has an e-mail address text box, you can copy that text box to the second view. When a user types their e-mail address in one view, it will automatically appear in the other view.

In this article:

Introduction to viewso The user experienceo Design considerationso The Views group on the Page Design tab

Add a view Delete a view Change the default view Rename a view Add a button for switching views

14

Introduction to views

The user experienceBy default, users of your form can switch views by selecting the desired view from the Views/Page Views group on the ribbon. Each view will be listed by its name and the active view will be highlighted. All views will be listed, except those views that have had the Show on the View menu when filling out this form check box unchecked on the View Properties dialog box.

If none of the views have the Show on the View menu when filling out this form check box selected, the Page Views group on the Home tab will not appear. This is useful in scenarios where you don't want users to be able to access views other than the one that you intend for them to fill out. For example, a form that is used to collect feedback about job applicants might have three distinct user roles associated with it — one for recruiters, one for interviewers, and one for hiring managers. For each user role, you can design a slightly different view of the form.

Note The ability to hide views from users is not a security feature. Users can still see the data if they know how to access the XML data itself.

To help prevent interviewers from switching to the recruiter or hiring manager views, when you design the recruiter and hiring manager views, you can open the View Properties dialog box and clear the Show on the View menu when filling out this form check box.

Note In form options, the ability to switch views can be disabled for users who fill out the form in a Web browser. Click the File tab, click Info, click Form Options, and then in the Web Browsers section, clear the Views check box.

To customize the view switching experience, add view switch buttons to the form as explained later in this article.

Design considerationsAs you design a new view, you will typically need to perform the following tasks:

1. Plan the view. Plan each of the views and how they will work together while paying attention to considerations like:

Which one of the views should appear when the form is first opened? Do users need to use multiple views? How will they move between them? Do any of the views need to be read-only? Are users likely to print any views from the InfoPath form?

2. Populate the view. When you add a new view to a form, it will start with a page layout template.

From here, you can add layout tables from the Insert tab on the ribbon to structure your form and add controls from the Home tab in the Controls group. You can also add controls to the new view that share the same field as controls that are used on other views by dragging the

15

appropriate field from the Fields task pane.

3. Customize the navigation experience. How will users be able to navigate through the form? Will the user know what the default commands for switching views mean? Are the default commands adequate, or do you want users to be able to switch between views by clicking a button that appears directly on the form? If the user will click a button, will you use a tabbed user interface or back and next buttons? For print views, do you want users to print all of the views at once, or only the active view?

The Views group on the Page Design tabOn the Page Design tab of the ribbon, in the Views group, you can add or delete views, or switch between different views. To customize the settings and behavior of a selected view, click the Properties buttonto open the View Properties dialog box.

You can also create and associate a print view with an existing view by first creating the print view to appear when you want the form view printed, then assigning it to an existing view via the View Properties dialog box. You can also specify custom printing options for the print view on the Print Settings and Page Setup tabs of the View Properties dialog box, such as headers, footers, and page margins.

Add a viewUse the following procedure to add additional views to a form.

1. Click the Page Design tab then, from the Views group, click New View.

2. Type a name for the view, and then click OK.

3. To open the View Properties dialog box, click the Page Design tab then, from the Views group, click Properties.

4. In the View Properties dialog box, change or specify the desired settings or options for the view, and then click OK.

16

5. In the workspace, design the view by adding layout tables and controls to it.

Tip If you want to base the design of a new view on an existing view, open the existing view, press CTRL+A to select everything in the view and press CTRL+C to copy the selection to the Clipboard. Select the new view from the View list in the Views group on the Page Design tab, delete the pre-populated content in the view then press CTRL+V to paste the selection into the new view.

Delete a viewYou cannot recover or restore a view after you delete it. If you delete the default view in a form that has only one view, InfoPath creates a new default view automatically. If you delete the default view in a form that has multiple views, InfoPath will assign default view status to the next view in the list of views shown on the Page Design tab, in the Views group, on the View list.

1. Select the view that you want to delete on the Page Design tab, in the Views group, from the View list.

2. On the Page Design tab, in the Views group, click Delete.

3. When prompted to delete the view, click Yes.

17

Change the default viewEach form has a default view. Users see this view when they open a form that is based on your form. If you create custom views for a form, you can choose which of the available views will be the default view for your users.

1. Select the view that you want to make the default view on the Page Design tab, in the Views group, from the View list.

2. On the Page Design tab, in the Views group, click Properties.

3. Select the Set as default view check box, and then click OK.

Note If a form has only one view then it is automatically designated as the default view.

Rename a view1. Select the view that you want to rename on the Page Design tab, in the Views group, from the

View list.

2. On the Page Design tab, in the Views group, click Properties.

3. On the View Properties dialog box, type the new name for the tab in the View name text box then click OK.

Note If you rename a view that is associated with custom code, the code may not work as expected. To fix this problem, you must find all references to the old name of the view in the code and update them with the new name of the view.

Add a button for switching viewsViews are often designed to work with rules. Rules enable you to automate certain tasks in response to events or actions initiated by the person filling out the form. For example, you can insert a button on your form and create a rule that switches views when the button is clicked and, after you insert the button on your form, you can associate the rule with the button so that it switches views when a user clicks it.

More specifically, in an insurance claim form, you might create a Show Summary button that opens a high-level view of the claim data when clicked. In the summary view, users could then click a Show Details button to return to the more detailed view. Likewise, if you have a very long form, you could break it into multiple views and add next and back buttons or tabbed navigation to allow users to navigate through the form.

Insert a button in each view. Note To complete the following procedure, you must have a form with two existing views.

1. Select the view that you want to add a button to on the Page Design tab, in the Views group, from the View list.

18

2. Place the cursor on the form where you want to insert the button.

3. On the Home tab, in the Controls group, select Button.

4. Under Control Tools, click the Properties tab in the ribbon.

5. In the Label box, type a name for the button, and then click OK.

2. Create a rule that switches views.

1. Select the button.

2. Under Control Tools, on the Properties tab, in the Rules group, click Add Rule.

3. Select When this button is clicked then select Switch Views from the Actions list.

4. In the View text box, select the view to display when the button is clicked, and then click OK.

3. Repeat steps 1 and 2 to create additional buttons and corresponding rules for each view.

4. After you have added buttons to your views and created the necessary rules, it is recommended that you test the form to ensure that it works as expected.

19

1. On the Home tab, in the Form group, click Preview.

2. Click the buttons to make sure that you are able to switch between views as desired.

Note The view that you were working in most recently is the view that will appear in the preview window, unless a rule has been created to switch the view based on the user’s role at form load.

Note In read-only views, buttons are not available. For navigation in read-only views, such as the display view in a SharePoint list form, use a picture button and clear the Hide picture button in read-only views check box from the control properties dialog in the Properties tab of the ribbon.

20

Publish a FormLink to original article.

When you are finished designing a form template, you must publish it so that users can fill out forms based on the form template. Users must have access to the location where the form is published. This topic described the different options to publish an InfoPath 2010 form.

In this article

Publish vs. save

Publishing options

o SharePoint library or list?

Publish to a SharePoint Library

Publish versus savePublishing a form template is not the same as saving a form template. When a form template is saved, you are saving it to preserve your work, just as you do when you save a file on your computer. The publishing process modifies the form template for distribution by adding the publish location and processing instructions sections so that users can open forms that are based on this form template. The processing instructions allow forms that are based on this form template to be automatically updated if you make changes to the form template after publishing it.

Publishing optionsThere are a number of different ways that you can publish your InfoPath forms. To publish a form, click the File tab, and then click Publish to be presented with the following options:

Quick Publish Publish form to current location

If you are updating a form that has already been published, or are publishing a SharePoint list or workflow form for the first time, you can use quick publish to publish the form without having to indicate how and where it will be published. When you click Quick Publish, InfoPath 2010 automatically re-publishes or publishes the form to its previous or indicated location.

Note If a publish location has not been specified, Quick Publish is disabled.

SharePoint Server Publish form to a SharePoint Library

If you want to publish an InfoPath form to SharePoint so that users can fill it out in a Web browser or in InfoPath filler then you can publish it to a SharePoint library. Users will then be able to access the form online, fill it out, and save the results as an InfoPath document in the library.

21

E-mail Publish form to a list of e-mail recipients

You can create a new e-mail message that contains an InfoPath form. This option is useful when the recipients do not have access to a SharePoint site.

Note InfoPath Filler is required for forms that have been published in e-mail messages.

Network Location Publish form to a network location or file share

This publishes the form to a network location or file share which allows the users to be able to navigate to the share (such as //MyShare/Path/FormLocation) and fill out the form in InfoPath Filler.

Note InfoPath Filler is required for forms that have been published to a network location.

SharePoint library or list? In previous versions of InfoPath, you could publish a form to a SharePoint library, and, when users filled out the form, it would save their responses as documents within that library. While you can still do this, you can now use InfoPath 2010 to customize the form used to create, read and edit items in a SharePoint list so that responses are saved as items in the list. To do this, click Customize Form in SharePoint, or create a new SharePoint list from within InfoPath.

There are some distinct advantages to using a SharePoint list, instead of a document library, as follows:

You can manage the responses in the same way that you do with any items in a SharePoint list.

You do not have to specify how to connect to the SharePoint server when publishing the form because this is automatic.

When you are done customizing the list form, you only need to click Quick Publish to publish the form.

Publish to a SharePoint LibraryTo publish an InfoPath form to a SharePoint library, perform the following steps:

1. Click File.

2. Click Publish.

3. Click SharePoint Server.

22

4. Enter the Web address of the SharePoint site in the text box.

5. Click Next

23

1. Select how to publish the form. For most scenarios, select Form Library.

7. Click Next

8. Click a pre-existing form library for the InfoPath form if one has already been created or click Create a new form library to create a new one.

9. Click Next

10. If you are creating a new SharePoint library, enter the name of the library in the Name text box and a description for the library in the Description text box.

24

11. Click Next

12. To display data from your form as a column in the form library, use property promotion. To do this, click Add, select a desired field, and then type a name for the column in the Column name box.

13. If you selected a repeating field, click a value in the Function list to define how to display the field in the form library, and then click OK.

Note You can choose whether to display the first value in the field, the last value, or a count of all the occurrences of the field, or whether to merge all the values together.

14. Repeat steps 12 and 13 as necessary for each field in the form that you want to add as a SharePoint column, and then click Next.

15. Click Next. Click Publish.

25

Data Connections OverviewLink to original article.

A data connection is a dynamic link that is used to receive or submit data between a Microsoft InfoPath form and data that is saved outside the form, such as a SharePoint server, Web service, or database. For example, in an order form that contains a list of available products, the static list of product names could be saved in the form. However, any time a product is added or removed, the product list in the form must be updated.

To make sure that the form stays up-to-date, save and maintain the product information outside the form. Create a data connection to add this information to the form when users fill out the form. The benefit of using a data connection to retrieve the product information is that this information can be saved in a single place that multiple forms can link to. Also, you are assured that users always have the latest information when completing a form.

In addition to receiving data, data connections can be used to submit data. After a user has filled out a form, they must submit the form. By adding submit data connections to forms, you can specify where the form data is submitted. For example, a form can be submitted as a document to a SharePoint document library or sent in an email message.

In this article

Local versus external data

External data connection types

o Submit data connection

o Receive data connection

Local versus external dataAll InfoPath forms save the data that is entered into them. Controls are used to display the data to users. When a user submits the form, the local data in the form is submitted to one or more external locations.

Data connections can be used when you need to query data from outside the form, or when you want users to submit data to multiple locations. There is no limit to the number of data connections that can be created.

If you create a data connection that queries data, the form queries this data connection by default when the form opens. You can also use this data connection by configuring the form in the following ways:

Add a refresh button that users click to query the external data

Add a rule to query the external data by using this data connection

26

Add custom code that queries the external data based on some other event

External data connection typesYou can create submit data or receive data connections to exchange data with a data source outside of a form.

Submit data connectionWhen users submit a form that is based on a SharePoint list or a database, the list or database is updated with the changes made by the user when they submit the form. A form can also be configured to allow users to send data to other locations. The following external data locations can be used:

Web service

Document library on a SharePoint site

E-mail message

Hosting environment (such as an ASP.NET page or a hosting application)

In most cases, one submit data connection is used when the form is submitted. However, a form can submit data to multiple locations by using rules or custom code. For example, forms can be submitted to a Web service as well as through an email message. Typically, forms are configured to submit all of the data in the form. However, with custom code to submit the form data or configure the form to submit data to a Web service you can choose to submit only a portion of the form data.

Receive data connectionA receive data connection gets data from an external source to populate fields in the form. Controls can then be bound to those fields to display the data from the external source in the form. For example, a receive data connection is commonly used to populate a drop-down list box. The following sources can be used:

SOAP Web service

REST Web service

SharePoint library or list

Database (Microsoft SQL Server only)

XML Document

27

Tips and Tricks for Making Form Filling FasterLink to original blog post.

The less time it takes to fill out your forms, the more time your users can spend on other tasks. Also, odds go up that form fillers will complete forms when they take less time to fill out. This blog post will give you a few tips for speeding up form filling and improving accuracy so your forms are completed faster.

In this post we will cover

1. Using defaults

2. Using contextual defaults for bringing in the current day and user

Setting up default valuesFor questions where one answer is much more common than others, it can be useful to set up default starting values. The value you choose will appear when the form is opened, but the form filler is still able to change it.

You can set default values by selecting the control and clicking on the properties pane, and then choosing “Default Value”.

Let’s say I had a sailboat rental form, and when boats are rented employees need to fill out who checked out the boat, when it was checked out, what type of boat it was, the boat #, and customer information.

28

Because the sailboat rental place has mostly 24 foot boats, we can set the default Size to be 24 feet. Now employees won’t have to fill this field out most of the time. To set a default value, select the control (the boat size dropdown), choose the Properties tab, and select Default Value. Type the default value in the box provided. You can set the defaults for text boxes, combo boxes, check boxes and many other controls this way.

Contextual valuesWhen a boat is being checked out, we need to log the person who checked it out and the date. Most commonly, boats are checked out for today’s date. We want to set the default value of “checked out by” date to be today’s date.

To set the checked out date to today, select the date control, go to the properties tab, and choose

“default value”. Choose the function builder at the right .

Choose the “Insert Function” button and pick the now() function from the Date and Time Category. Click “OK” until you return to the form. Now, when users open the form today’s date will be automatically filled in. When using today() or now(), the form will update the date when you re-open it unless you uncheck the “Refresh value when formula is recalculated”. Make sure to uncheck this box.

29

today() vs now()

today() and now() can both be used to set the default value of a date picker. However, the type of form you have can affect which one you use.

- Use today() when you have a date-only field.

- Use now() when your field requires a date and time.

In general, when using a SharePoint list form, use now(). When using a form library or filler-only form, use today(), unless you have changed the data format of the date field to date and time.

Setting up the default user

Setting the default value of the Person/Group picker is done through the fields task pane. Show the fields task pane by selecting “Show Fields” on the data tab and expand your Person/Group picker field (in my case, outBy). Click “Show advanced view” to see the detailed view. Right-click on the AccountId and choose properties.

30

Under default value, choose the function builder and type userName(). Again, make sure that “Refresh value when formula is recalculated” is unchecked, so that this rule is only run once and not every time the form is opened. Click Ok.

Repeat this process with the DisplayName (optional) to get the best experience. Now the people picker will default to the person who opens the form. When we load the form, the date, boat type, and checked out by fields are already filled out. With half of the fields completed, it will take employees less time to check out boats.

31

Hopefully, these tips will help you set good defaults and your users will spend less time filling out forms!

32