Form design notes - address validation
Once the InfoPath Form has been generated from Designer (see Workflow design notes), then you will be able to configure input parameters for the Address Doctor Web service.
Only fields listed below were configured, and others have been left as blank.
Note: See section 5.5 of Address Doctor's Web Service (SOAP) documentation (.PDF file) for more details on setting parameters.
The folders appear in the form under a folder with the group name (Address) (see below)
The lists below are recommended default values to be set for this example. Follow these steps for each field:
The recommended default values or this example are listed in the following table.
ISO_2 (Note: SAP uses only 2 digits for Country Code)
The following should be mapped or set to equal the corresponding fields in the form that the user fills in. These are the address fields that the web service will validate.
The example below shows the address validation service in the form. The table following the image lists the fields that were mapped to a repeating table for the Search output.
Note: You will need to manually add a field as shown above by the check box under select- this allows the user to pick which address they want to use based on the results. To do this right-click on the folder you want to add the field to and click Add
This provides the full address in a single field, making it easier for the user to see the full address and make a selection.
This returns a percentage of how well the address matches the results returned.
This returns the number of addresses returned.
This is optional, but it can be useful. It should not be used in the repeating table because there is only one value for the results. It is shown above the repeating table in this example.
Creating a rule
In the following section, you will add a rule to fill in the address fields based on the users selection (the 'Select' checkbox in the Address Validation screen shown above).
The rule should be applied when the check box is selected (i.e TRUE), and trigger an Action rule that will set the following fields. These can be also the same fields that you choose to validate. Once the validation finishes, you can overwrite the fields with the validated data.
Note: Although the output shows the complete address in one field (FormattedAddress_2) you will probably need to use individual fields to set the address in your form because SAP stores data in different fields. These can be also the same fields that you choose to validate. Once the validation finishes, you can overwrite the fields with the validated data.
To set the fields, do the following.
The following fields are recommended to be set based on this rule. Repeat the steps above for each field in the following list.
Note: You only need one rule, and you can set as many fields based on the rule as required.
The following fields are all located under Address_Output\ValidateResult\Results\Result\Address
House Number field that the form will use to update SAP
Street field that the form will use to update SAP
City field that the form will use to update SAP
Postal code field that the form will use to update SAP
State/Region field that the form will use to update SAP
Country field that the form will use to update SAP
Create a button to call the Web Service
With the Web service added and the fields mapped and configured, all that is left is to add a button to the form so users can click it and validate an address they have entered.
- Add the WS.Web Service control to your form where you want the button to be located.
- Right-click the Web service button, and then select WS.Web Service Properties
- On the Data tab, enter a name for the button (for example, Validate)
- On the Web Service tab, click Add, and then select the Address Web Service.
- Check When button is pressed, and then type the name (Address Validation) for the button. (This is the name that appears on the actual button in the form.)
- Click OK