Configuring autofill and autocompletion in address-config.xml

To configure the fields that support address autofill and autocompletion for a country, configure that country’s address-config.xml file.

Note: The address-config.xml file uses zones defined in zone-config.xml. See Zone configuration files.

PolicyCenter stores address-config.xml files in country-specific folders under the geodata folder, which you can access in Guidewire Studio. For example, the address-config.xml file for Japan is stored in the following folder:

configuration > config > geodata > JP

The following default configuration for the United States, in configuration > config > geodata > US, shows elements that you can use in this file:

<AddressDef name="US">
  <Match>
    <Field name="Country" value="US"/>
  </Match>
  <Fields>
    <Field name="City" zonecode="city">
      <AutoFillFromZone code="zip"/>
      <AutoFillFromZone code="state"/>
    </Field>
    <Field name="County" zonecode="county">
      <AutoFillFromZone code="zip"/>
      <AutoFillFromZone code="city"/>
      <AutoFillFromZone code="state"/>
    </Field>
    <Field name="State" zonecode="state">
      <AutoFillFromZone code="zip"/>
      <AutoFillFromZone code="city"/>
    </Field>
    <Field name="PostalCode" zonecode="zip">
      <AutoFillFromZone code="city"/>
      <AutoFillFromZone code="state"/>
      <ValidatorDef
         value="[0-9]{5}(-[0-9]{4})?"
         description="Validator.PostalCode.US"
         input-mask="#####-####"/>
    </Field>
  </Fields>
</AddressDef>

The following table describes the elements in the address-config.xml file.

AddressDef

The name of the address format. This element takes a name attribute and an optional priority attribute. By convention, the name is the country code.

A country can have more than one address format—for example, it is possible that different regions have different formats. The priority attribute specifies which address definition has priority if several of them match. The highest priority is 1, the next lower one is 2, and so on.

Match

Each AddressDef must contain one Match element. PolicyCenter matches only on the country. The Match element contains a Field subelement that defines the name and value attributes that the application uses to determine which definition applies.

Fields

Each AddressDef contains a single Fields element that contains a list of the address Field elements.

Field

Specifies an address field. Each field takes a name that must match a property on the Address entity. The Field element can appear in the Match element or the Fields element.

In the Match element, the Field element has a required name attribute and an optional value attribute, which is the code value from the Country typelist. It has no child elements.

In the Fields element, the Field element has a required name attribute and optional zonecode and autoCompleteTriggerChars attributes. It can also have the child elements AutoFillFromZone and ValidatorDef.

  • The value attribute is a valid value for the Field. This value is usually a code value from a typelist, such as a state typecode from the typelist for a Field with the name set to State.
  • The zonecode attribute corresponds to a Zone code configured for the given country in zone-config.xml. This value links the Address configuration to the Zone configuration. For information on zone configuration, see Zone configuration files.
  • The autoCompleteTriggerChars attribute specifies the number of characters to enter before the application triggers autocomplete. The default value is 0 (zero).

AutoFillFromZone

Specifies a field that is examined for autofill and autocompletion of the field. PolicyCenter uses the zone code to look up the field value. See Zone configuration files.

ValidatorDef

Contains information for validating the field in the optional attributes value, description, and input-mask.

Note: Do not define field validators in address-config.xml. Guidewire recommends that you define them in fieldvalidators.xml. See Field validation.

The previous address-config.xml example defines a Match on the country with the match value as US. Additionally, it defines four fields:

  • City
  • County
  • State
  • PostalCode

Each field defines one or more AutoFillFromZone elements. Looking at the County, you can see that the application fills the County from the zip, the city, and the state. Each AutoFillFromZone entry must correspond to a <Link> definition in zone-config.xml, as described in Zone configuration files. That file specifies that autofill can use ZIP code and city for the look-up operation.

As PolicyCenter loads address-config.xml, it validates the configuration. PolicyCenter verifies that every Field element, regardless of whether it is defined in Match or Fields, corresponds to a field on the Address entity. Then, PolicyCenter verifies that each AutoFillFromZone element references a zone in zone-config.xml.

See also