Form design notes - dynamic default values
SAP F4 Look up
One way to dynamically set a field is to allow the user to look up values directly in SAP for a specified field (from the form). You can do this by adding a custom Winshuttle control (WS.SAP Field Lookup) to the InfoPath form.
Note: This is only available for fields that SAP supports F4 lookup (e.g. New Weight does not support F4 but Weight Unit does).
- In InfoPath, drag and drop the WS.SAP Field Lookup control on the form next to the field you want to use the Look up value for
- Right-click the control icon
, and then select SAP Field Lookup Properties
- Click the SAP Field Lookup Tab
- Next to Mapping Name, click the drop-arrow, and then select the Script that contains the Look up field
- Next to SAP Field, click the drop-arrow, and then select the Field you want the F4 lookup to use.
- Click OK.
See video and further info in the following Winshuttle blog entry.
Using drop down lists to filter data
You can use a drop down list for one field to filter data of another field.
For example, you can create a drop down list for Distribution Channel that is dependent on the selection for Sales Organization (manual selection of a drop down). The actual drop down list for the distribution channel can contain all possible values, but a filter can reduce the drop-down list based on the value of the Sales Organization.
Note: You can disable the dependant (e.g. dist. Channel) field until the related field(e.g Sales Org.) is populated.
You can set values of drop-down lists/pick lists a number of ways. (See Populating Pick lists on forms)
Whichever method you choose, you can dynamically set up a filter based on a different field(s) in a form.
- Right-click on the dropdown field and select Drop-Down List Box Properties.
- Use one of the following two choices from the List box choices
Get choices from fields in this form: Use this if you want to use a Query output (select the repeating section) to be values for a drop down field.
Get choices from an external data source: Use this if you want to use an external source such as a SQL query or SharePoint list.
- Click the Select Xpath button
for the Entries
- Click Filter Data…
- Set your filter criteria. Typically a field in the external data source equals a field in the form.
Using Action Rules to set field values
To dynamically set one or more fields value based upon a value entered in another field, follow these steps:
- In InfoPath, highlight the field on the form view you want to use to derive another field. For example, if a value for Plant derives the MRP type, then you should highlight the Plant field.
- Under Rules (see InfoPath menu bar Properties à Manage Rules) click New
- Click Action.
- In the Condition dialog box, click none (because you have not created a condition yet).
- Create the condition, and then click OK.
Note: When the condition is true it will require the action (in this case plant_1 =1000). The AND or OR operators can be used here, too.
- Next to Run these actions (under the same "Rules" dialog box - see below) Click Add.
- Click Set a fields value from the dropdown.
- Select the field you want to set based on the condition above (e.g. MRP Type)
- Select the value of the field in step 9 (note you can use a formula for the value if needed)
- Click OK
Promoting fields to drive workflow decisions
When using conditional workflow, you will need to promote the fields on the form that drive workflow decisions. To promote a field in InfoPath, do the following:
- On the InfoPath menu bar, click File, and then click Form Options.
- Click Property Promotion
- Click Add
- Select the field from the form, and then click OK.