Edit supporting user interface files and add New Zealand suburb field
Before you begin
Procedure
-
Press Ctrl+Shift+N and enter
Address.en, and then double-clickAddress.enin the search results to open it in the editor. -
In the top part of the editor, click the Add icon and
then enter the following values:
- Name –
suburb - Entity Path –
Address.Suburb
- Name –
-
Below this top pane, there is a code pane with a
Defaulttab. Click this tab and add a line of code defining aSuburbto the list offormatteraddress field definitions. If necessary, add a comma to the end of the preceding line::CEDEXBureau = CEDEXBureau, :Suburb = suburb -
In ContactManager only, this code pane also has a
Fulltab. Click this tab and make the same addition as you did in theDefaulttab. -
Press Ctrl+N and enter
AddressOwnerFieldId, and then double-clickAddressOwnerFieldIdin the search results to open this class in the editor. -
Add the following line of code to the constant declarations for available fields:
public static final var SUBURB : AddressOwnerFieldId = new AddressOwnerFieldId("Suburb") -
Add the
Suburbfield to the constant representing all PCF address fields:public final static var ALL_PCF_FIELDS : Set<AddressOwnerFieldId> = { ADDRESSLINE1, ADDRESSLINE2, ADDRESSLINE3, SUBURB, CITY, COUNTY, STATE, POSTALCODE, COUNTRY, ADDRESSLINE1KANJI, ADDRESSLINE2KANJI, CITYKANJI, CEDEX, CEDEXBUREAU }.freeze() -
Hide the
Suburbfield from the default search screens by changing the settings inAddressOwnerFieldIdforHIDDEN_FOR_SEARCHandHIDDEN_FOR_PROXIMITY_SEARCH:public final static var HIDDEN_FOR_SEARCH : Set<AddressOwnerFieldId> = { ADDRESSLINE1, ADDRESSLINE2, ADDRESSLINE3, SUBURB, COUNTY, ADDRESSLINE1KANJI, ADDRESSLINE2KANJI, CEDEX, CEDEXBUREAU }.freeze() public final static var HIDDEN_FOR_PROXIMITY_SEARCH : Set<AddressOwnerFieldId> = { ADDRESSLINE1KANJI, ADDRESSLINE2KANJI, SUBURB, CITYKANJI, CEDEX, CEDEXBUREAU }.freeze()You can change this setting later if New Zealand is to be the default region.
-
Press Ctrl+N and enter
AddressFormatter, and then double-clickAddressFormatterin the search results to open this class in the editor. -
Add the following
casetoswitch(_addrCountry)to indicate the suburb, city, and postal code format for a New Zealand address:case TC_NZ: append(cszBuf, fieldId.SUBURB, delimiter, addr.Suburb) append(cszBuf, fieldId.CITY, " ", addr.City) append(cszBuf, fieldId.POSTALCODE, " ", addr.PostalCode) break
What to do next
The next step is Add a New Zealand suburb field to the user interface.
