Blog

How to: configure functionality for a Custom Address block (legacy interface)

This article will cover how to configure your custom address block(s) with AddressTools allowing for on-save standardization, validation and also all interactive functionality.

Note: Functionality for custom fields and address blocks is only available for AddressTools Premium. If you are using AddressTools Free, you can trial our AddressTools Premium application to take advantage of the features covered in this article.

In the following example, we will be covering how to configure a custom address block that we have created on a custom object named Locations. All the information gained in the article can be translated to any other object of your choice including Salesforce’s standard objects.

Adding the Address Block to Fields to Validate/Standardize

With an address block already created on our Locations object, we need to add it to the AddressTools Fields to Validate/Standardize section.

Go to the AddressTools Administration tab and select the Settings sub-tab. Once on this page, locate the Fields to Validate/Standardize block and select Add.

Continue to the next page to see the Field Mapping page.

Below you can see all of the settings covered in the Field Mapping page:

First, start in the Select Object settings and choose the object you want to configure. Then if applicable, choose a Record Type if you’re adding functionality to only records of a certain type. If the Record Type field is left blank, the settings will cover all Record Type for the object. For this example, I have chosen the Record Type Delivery Address, as these are the records that I want AddressTools functionality to be active on.

Next, we want to link all the required fields within the Field Mappings section. Please see each field and its supported field type below:

  • Country – Text Field (255)
  • State – Text Field (255)
  • City – Text Field (255)
  • Street – Text Field (255)
  • ZIP Code – Text Field (255)
  • Address Status – Picklist

Values: Not checked, Not matched, Parsed but not found, Ambiguous, Corrected, Verified. Restrict picklist to the values defined in the value set: False.

  • County – Text Field (255)
  • Country Lookup – Lookup (Country)
  • State Lookup – Lookup (State)
  • Zip Code Lookup – Lookup (ZIP Code)

A completed Field Mappings section should look similar to the following, but your field names may differ.

Note: not all fields are required, for example, Address Status, County, Location Accuracy and Location Source fields are only required when using Premise-Level Address Verification.

Creating a Trigger for Validation & Standardization

AddressTools comes pre-configured with a trigger for AccountsContactsContracts and Leads. If you are configuring an address block on any other object in your Org, you will be required to create a new trigger to fire the AddressTools functionality on record insert and update.

Start by going Setup and navigate to the triggers section for the object you are dealing with. For standard objects, this is located in Customize → Object Name → Triggers, and for custom objects, this is located in Create → Objects → Object Name and then scrolling to find the Trigger section on the loaded page.

Select New to create a new trigger on your object.

Paste the following code into the text area provided

trigger ValidateLocationCountryFields on Location__c (before insert, before update) { pw_ccpro.CountryValidator2.Validate(Trigger.new, Trigger.oldMap); }

Rename the ValidateLocationCountryFields to a name that is suitable for your org, we recommend simply changing Location to the label of the object you’re dealing with.

Next, change the Location__c to the object’s API name that you’re working with.

Once these changes have been made, select Save.

Note: each object only requires one trigger removing a requirement to create multiple triggers for multiple address blocks that exist on the same object.

Contact Us

You will now find that your custom address block has been successfully configured with all AddressTools functionality. If you are experiencing any issues with the setup, please reach out to support@provenworks.com where a member of our team will be happy to assist.

Leave a Reply