Blog

AddressTools Premium: Turn on validation rules

Enabling validation rules

Once all validation rules have been configured for each address block with country-specific settings specified, the validation functionality needs to be enabled for the organization. In the event that you want to disable all configured validation rules, the following setting can be disabled.

  • Go to App Launcher | AddressTools Administration.
  • Select Settings from the sidebar.
  • Click the pencil next to Validation Enabled.
  • Tick the Validation Enabled box to enable validation.
  • Click Save.

Testing a validation rule

With validation rules configured and enabled for an address block, it’s great to test the changes to see if everything is working as expected.

  • Navigate to a record in Salesforce on the object you have configured.
  • Edit the address block to breach a configured validation rule.
  • Attempt to save the record.

If everything is configured correctly, your validation rules will prevent the record from saving and provide an alert for what needs to be rectified. After rectifying the data, the record will then save.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Understanding validation rules and what’s available

First things first

Before we get started, address validation and address verification are often thought to be the same thing, but within AddressTools, they are two separate pieces of functionality. Let’s take a closer look at both so you can work on implementing the right features for your organization.

What is address validation?

Address validation provides validation rules to the configured address blocks in Salesforce. For example, make fields mandatory, limit field entry to only acceptable values, and enforce regular expressions for fields like Zip/postal code. Validation rules are great for ensuring that data meets organizational requirements, simplifying reporting, minimizing dirty data, and it can be essential to reduce integration syncing headaches.

What is address verification?

Address verification leverages external data points such as USPS, Royal Mail and Canada Post to verify the deliverability of an address. There are interactive real-time and automated/batch options available to verify address data with AddressTools. To find out more about address verification in AddressTools, check out the Understanding address verification in AddressTools article.

What address validation rules are available in AddressTools?

See a full list of validation rules available in AddressTools below:

Country-wide:

  • Country Mandatory
  • Allow Only Listed Countries

Country-specific:

  • Street 1 Mandatory
  • Street 2 Mandatory
  • City Mandatory
  • State Mandatory
  • ZIP Code Mandatory
  • Allow Only Listed States
  • Validate Postal Code Against Regex

US only:

  • Enable City and State Validation Against US ZIP Code
  • Allow Only Listed ZIP Codes

Now that we know what validation rules are available, let’s take a look at configuring the country-specific validation rules, followed by enabling all the rules for configured address blocks.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Configure country-specific validation rules

Why are some validation rules country specific?

AddressTools allows you to configure some of its validation rules on a per-country basis.

Example:

United States

  • Street 1 Mandatory = TRUE
  • State Mandatory = TRUE

China

  • Street 1 Mandatory = FALSE
  • State Mandatory = TRUE

This above example can be seen in the screenshot below.

Country-specific validation rules are essential when certain elements of address data are required for different countries. These types of restrictions are particularly popular to avoid integration nightmares when data is pushed out to different systems.

Configuring the country-specific settings

To configure country-specific validation rules:

  • Go to App Launcher | AddressTools Administration.
  • Navigate to Country Specific Settings on the sidebar.
  • Configure the Multi-Select Picklists to your requirements by selecting a country in the relevant list and selecting the horizontal arrow to move it from one list to the other.
  • Once all items have been adjusted, select Save.

Note: despite a value existing in one of the enforced lists, the setting will not be enabled until it is checked in the address block configuration, followed by checking Validation Enabled in the settings tab. This will be covered in the following articles.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Add new address block

What’s in an address block configuration?

With the object’s trigger created or confirmed that one already exists, we now need to create an address block configuration.

An address block configuration identifies address fields on an object that we’ll want to enable AddressTools functionality onto. It also provides settings specific to that address block which can be enabled/disabled at a later stage such as making fields mandatory, or enabling standardization.

Let’s take a look at all the parts that go into an address block configuration:

  • Object – the object where the address fields exists.
  • Record Type – the record type where you want the functionality to be applied.
  • Postal Address Fields – street, city, state, ZIP/postal code and country field.
  • Additional Data Fields – county and address status field, for use with verification.
  • Lookup Fields – country lookup, state lookup and ZIP/postal lookup field, for use with lookup population.
  • Global Settings – enablement for international validation rules and standardization.
  • Country Specific Settings – enablement for country specific validation rules.
  • Premise-Level Address Verification Settings – options and enablement for verification.

As you can see, there are a lot of pieces that go into an address block configuration. However, certain settings can be skipped depending on your implementation.

This article will cover binding the object, record type, and postal address fields with AddressTools. The additional items will be covered in the specific articles related to enabling their features.

Note: after initial data installation has occurred, Accounts (billing address and shipping address), Contacts (mailing address and other address), Leads (address) and Contract (billing address and shipping address) will already be configured with settings ready to customize.

Binding a new address block

  • Go to App Launcher | AddressTools Administration.
  • Select Address Blocks from the sidebar.
  • Click Add in the top right corner.
  • Choose the Object where the address fields exist.
  • If applicable, choose a Record Type.
  • Select Next.

Note: if you leave the record type as “none”, the configured functionality will apply to all record types for the object unless another address block configuration covers a specific record type where those settings will be applied instead.

With the object and record type confirmed, the address block configuration modal will appear where we can start mapping the postal address fields that we want to bind to AddressTools.

Within the Postal Address Fields section:

  • Under *Country Field, use the picklist to reveal the object’s available fields.
  • Find and select the country field’s API Name.
  • Under State Field, use the picklist to reveal the object’s available fields.
  • Find and select the state field’s API Name.
  • Under City Field, use the picklist to reveal the object’s available fields.
  • Find and select the city field’s API Name.
  • Under ZIP/Postal Code Field, use the picklist to reveal the object’s available fields.
  • Find and select the ZIP/postal code field’s API Name.
  • Under Street Field, use the picklist to reveal the object’s available fields.
  • Find and select the street field’s API Name.
  • Once every field has been configured within the Postal Address Fields section, click Save.

Note: If you have multiple street line fields, use the + button next to Street Field to provide additional street field selectors.

With the postal address fields now bound to an address block configuration, continue through the installation walkthrough and use the relevant setup articles for the functionality you require. The specific articles will walk you through the rest of the address block modal options as you require them, teaching you along the way.

Note: if you cannot find a field you are looking for in any of the picklists, this indicates that the field may already bound in an existing address block configuration for the same object + record type combination, or you do not have permissions to view the field. First, check to see if the address block is already configured in AddressTools. If not, check the field level security of the fields in question.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Configure country standardization

Country standardization format selection

We’ll start configuring country standardization by setting up the expected standardized format. The available options are:

  • Full name
  • ISO-2
  • ISO-3
  • Local name (Latin characters)
  • Local name (Native characters)

To set the format for the country values:

  • Go to App Launcher | AddressTools Administration.
  • Select Settings from the sidebar.
  • Choose a Country Standardization Format from the dropdown menu.
  • Select Save.

Note: This setting will only be available once Standardization Enabled is checked.

Enable country standardization for an address block

Now that the desired standardization format has been selected, country standardization needs to be enabled for specified address blocks.

  • From the sidebar, navigate to Address Blocks.
  • Select Edit next to the address block you want to enable country standardization for.
  • Scroll to Global Settings.
  • Check Standardize Country.
  • Select Save.

Repeat the above steps for each address block you want to enable country standardization for.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Turn on standardization

Turn on standardization

With standardization formats set and address blocks enabled for country and state standardization, it’s time to enable the master setting for standardization functionality.

  • Go to App Launcher | AddressTools Administration.
  • Select Settings from the sidebar.
  • Click the pencil next to Standardization Enabled.
  • Tick the Standardization Enabled box.
  • Select Save.

If you ever need to disable standardization, simply uncheck the setting and save.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Configure state standardization

State standardization format selection

We’ll start configuring the preferred state standardization format for each country. The available options are:

  • Full name
  • Sub-code

This allows you to use sub-code values for one country, and full name values for another.

To toggle between the two:

  • Go to the Countries tab.
  • Choose All.
  • Select Edit next to the country record.
  • Check Use Sub Country Code in State field.
  • Select Save.

Repeat these steps for each country you want this configured for.

Enable state standardization for an address block

Now that the desired state format has been configured for each country, head to the address blocks section to enable the state standardization for listed address blocks.

  • Navigate to App Launcher | AddressTools Administration.
  • From the sidebar, navigate to Address Blocks.
  • Select Edit next to the address block you want to modify.
  • Scroll to Global Settings.
  • Check Standardize State.
  • Select Save.

Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Trigger creation and enablement

What do the triggers do?

AddressTools has a number of features that operate during the record insert and update operations into Salesforce. This includes (but is not limited to) enforcing validation rules, updating verification statuses, standardizing fields, and populating lookup fields.

A trigger is required on the objects that contain address fields that are configured with AddressTools. Without the trigger, most functionality will not fire and other functionality may appear to not behave as intended.

What triggers are already provided with the package?

The following objects already have a trigger provided with the package. This means you don’t need to create them:

  • Account
  • Contact
  • Contract
  • Lead

If you only plan to use AddressTools exclusively on the objects noted above, you can move on to the next article.

How can I disable the triggers provided with AddressTools?

In the event that you need to disable the triggers provided with the package, or you do not plan to use AddressTools functionality on some of the preconfigured objects:

  • Go to AddressTools Administration | Settings.
  • Scroll to Trigger Setting where you will find:
    • Enable Account Trigger
    • Enable Contact Trigger
    • Enable Contract Trigger
    • Enable Lead Trigger
  • Use the pencil icon next to the appropriate setting and uncheck the field.
  • Once done, select Save.

Creating a trigger for an object not supported out the box

So you’re looking to configure AddressTools on an object other than the four provided out the box. We’ve made it as straightforward as possible to add the trigger to the desired object!

  • Go to Setup.
  • Navigate to Object Manager.
  • Locate the Object you want to create the trigger for.
  • Select Triggers and New.
  • Paste the following code snippet into the box provided.
trigger ValidateOBJECTLABELCountryFields on OBJECTAPI (before insert, before update) {  
    pw_ccpro.CountryValidator2.Validate(Trigger.new, Trigger.oldMap);  
}
  • Replace OBJECTLABEL with the label name of the object you’re creating the trigger for.
  • Replace OBJECTAPI with the API name of the object you’re creating the trigger for.
  • Select Save.

Note: to deploy a custom trigger to production, you may be required to provide code coverage to the trigger. To do this, you will need to create an apex test to insert a record to the object you created a trigger on.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium: Create an authentication token

Create an authentication token

First, you will need to create an authentication token so that your organization can communicate with the AddressTools services. For some installations, this can happen automatically.

  • Go to App Launcher | AddressTools Administration.
  • If there is a green check next to Create an Authentication Token, you can move to the next step, if not:
  • Use the Create Token button.

Now that your organization can communicate with AddressTools’ services, you can move on to First-time data installation.


Back to the AddressTools Premium installation walkthrough

AddressTools Premium Installation Walkthrough

AddressTools Premium is the ultimate address functionality tool for Salesforce jam-packed with hundreds of features. This article will guide you through configuring the product for the first time and provide guidance on updating settings on an ongoing basis.

First-time initialization

Address block management

Validation rules

Standardization

Verification

Lookup field population

QuickComplete Country

ZIP Code Lookup (US only)

Interactive functionality

Deployment

How to purchase