ZIP codes, districts, streets, country key
Basics
The features of an address can be captured via these menu items.
Figure: Relevant section in the administration menu
A database of address data, i.e. street and district entities must be available to allow a lookup. New entities can be created via the administration menu.
ZIP codes
New ZIP codes are created intuitively. If a ZIP code is already entered in the system, it will appear in the ZIP code field with the city.
Figure: Creating a ZIP code
The ZIP code field is a picklist field. An exact resolution of the ZipCode dataset is not possible. That applies to all picklist fields.
Picklist fields save the key value in the database and not the primary key of the key entity. That means that the ZIP code '35418' will be saved in The database and not the associated Pk. If several datasets with the value '35418' exist in the ZIP code table, then any one of these datasets will be found and loaded.
List of all picklist fields:
SELECT * FROM attributemetadata WHERE lookuppicklistfield = 1
The address mask must be reset to its old version or must be corrected to solve the problem. In the EVI standard, the field 'City' will be filled automatically when the ZIP code value is changed. The description field for ZIP code is hidden and the 'City' field will be displayed in its place.
Figure: Validation of a ZIP code beginning with 3539.
District
'District' is a picklist field. A district can be entered depending on the country key and the ZIP code when creating an address. The validation process (from ZIP code to street) includes any previously entered values and displays a specific selection.
Select a district from the list and confirm your selection with Ok. This will ensure that a district from the table is applied.
Click the button Use [VALUE] if you are sure that the district exists, although this value is not in the table.
Alternatively, you can search for a specific value using a lookup search (button New search). When the value is applied, there will be no check if the selected value matches the ZIP code or the country key.
Figure: Districts search mask
Streets
Street is a picklist field. A street can be entered depending on the country key and the ZIP code when creating an address. The validation process includes any previously entered values and displays a specific selection.
Figure: Street lookup
Select a street from the list and confirm your selection with Ok. This will ensure that a street from the table is applied.
Click the button Use [VALUE] if you are sure that the street exists, although this value is not in the table.
Country key
'Country' is a lookup field. Only those country keys that are defined in the list can be entered. Alternatively, an empty key can be used.
Figure: Country lookup
Representation of foreign addresses
The composite addresses in CRM are created from the address dataset using a groovy script. The groovy scripts replaced the original hard coded application logic. In the advanced settings (application parameters), you can store your own specific logics for address generation per country key (primary key).
By default, the groovy script for the German country key and an example for the American address format are stored. For additional country keys, separate scripts must be stored. The application parameter from the default can be overridden and adapted customer-specific.
Script for German address generation
String composedAddress = "";
if (isPOBox) {
composedAddress += coNameFields;
composedAddress += concat(poBoxTerm, " ") + street + "\r\n";
composedAddress += concat(country, " - ") + concat(zip, " ") + concat(city, " ") + concat("- ", district);
} else {
composedAddress += coNameFields;
composedAddress += concat(street, " ") + streetNumber + concat(" ", streetNumberAddition) + "\r\n";
composedAddress += concat(country, " - ") + concat(zip, " ") + concat(city, " ") + concat("- ", district);
}
return composedAddress;
The script distinguishes between P.O. Box addresses and street addresses. The individual address values are available as variables in the script. The concat(String, String)
method is available for adding spaces or punctuation. This method ensures that the additional characters are only added if the address values are filled.
isPOBox - Is
true
for P.O. Box addresses,false
for street addressespoBoxTerm - The P.O. Box name specified in the P.O. Box field in the country key
country - The long name of the country.
countryKey - The country key of the country.
isForeignCountry - Can be used to suppress values (e.g. country key should be output only for foreign countries)
state - The state or canton. For American addresses the abbreviation of the state is necessary.
zip - The postal code
city - The city
district - The city part
street - The street name
streetNumber - The street number
streetNumberAddition - The street number addition