Add a New Zealand folder under the geodata folder

Before you begin

Complete the step Add New Zealand localization configuration files before you perform this step.

About this task

In this step, you create a folder for New Zealand under the geodata folder and add configuration files for country, address, and zone.

Procedure

  1. Navigate in the Project window to configuration > config > geodata.
  2. Right-click geodata and choose New > Package. Name the new package NZ.
  3. Copy the three files under the geodata/AU folder to this new folder. The three files are address-config.xml, country.xml, and zone-config.xml.
  4. Double-click the copied country.xml file to open it in the editor.
  5. Add Suburb to the visibleFields definition and remove State:
      visibleFields=
        "Country,AddressLine1,AddressLine2,AddressLine3,Suburb,City,PostalCode"
  6. Double-click the copied address-config.xml file to open it in the editor.
  7. Set the file up to use NZ as the country and the name, and to use Suburb instead of State:
      <AddressConfig xmlns="http://guidewire.com/address-config">
        <AddressDef name="NZ">
          <Match>
            <Field name="Country" value="NZ"/>
          </Match>
          <Fields>
            <Field name="City" zonecode="city">
                <AutoFillFromZone code="suburb"/>
                <AutoFillFromZone code="postalcode"/>
            </Field>
            <Field name="Suburb" zonecode="suburb">
            <!-- Do not autofill from the city because a definitive match 
                 to suburb from the city isn't possible-->
                <AutoFillFromZone code="postalcode"/>
            </Field>
            <Field name="PostalCode" zonecode="postalcode">
                <!-- Autofill first from suburb, because most people use suburb and 
                     postcode is a new concept. -->
                <!-- Postcodes are not unique by city. For example, 0420 maps to the
                     following cities: Cable Bay, Coopers Beach, Mangonui, Taipa -->
                <AutoFillFromZone code="suburb"/>
                <AutoFillFromZone code="city"/>
                <ValidatorDef value="[0-9]{4}" 
                  description="Validator.PostalCode.NZ" input-mask="####"/>
            </Field>
            </Fields>
        </AddressDef>
      </AddressConfig>
  8. Double-click the copied zone-config.xml file to open it in the editor.
  9. Change the country code to NZ:
    countryCode="NZ"
  10. Add Suburb to the zone definitions, change its relationship to postal code and city, and remove State.

    This file defines the CSV file order for each zone data entry to be postal code, suburb, city.

      <Zones countryCode="NZ">
      <!-- The uniqueness of the postcode is based on the containing zone. 
           The postcode's container is the country and the deciding factor is whether 
           or not the postcode is unique within the country. and not the fact that the same
           postal code is shared by multiple cities. For example, 0420 maps to the following
           cities: Cable Bay, Coopers Beach, Mangonui, Taipa -->
        <Zone code="postalcode" fileColumn="1" granularity="1" regionMatchOrder="1">
          <AddressZoneValue>Address.PostalCode.substring(0,4)</AddressZoneValue>
          <Links>
            <Link toZone="suburb" lookupOrder="1"/>
            <Link toZone="city" lookupOrder="2"/>
          </Links>
        </Zone>
        <Zone code="suburb" fileColumn="2" granularity="2" regionMatchOrder="2">
        <!-- As described for the postcode, the containing zone for the suburb 
             is the city and therefore the suburb is not unique per city. 
             Some examples: HillCrest is a suburb of both Hamilton and Rotorua. 
             Avondale is a suburb of Auckland and Christchurch -->
          <ZoneCode> city + ":" + suburb </ZoneCode>
          <AddressZoneValue>
            Address.City + ":" + Address.Suburb
          </AddressZoneValue>
          <Links>
            <Link toZone="postalcode" lookupOrder="1"/>
            <Link toZone="city" lookupOrder="2"/>
          </Links>
        </Zone>
        <Zone code="city" fileColumn="3" granularity="3" regionMatchOrder="3">
        <!-- City (and town) names are unique in the country. They might have similar
             names such as Palmerston North, which is in the North Island,
             and Palmerston, which is in the South Island, but there is 
             always a distinction. -->
            <AddressZoneValue> Address.City </AddressZoneValue>
          <Links>
            <Link toZone="postalcode" lookupOrder="1"/>
            <Link toZone="suburb" lookupOrder="2"/>
          </Links>
        </Zone>
      </Zones>

What to do next

The next step is Add a New Zealand field validator file.