Blog

How to automate Address Verification via a Record-Triggered Flow

Introduction

Salesforce Flows give admins a chance to implement advanced processes into their org with clicks, not code. Here at ProvenWorks, we want to empower admins to do more, so building on the capabilities of Salesforce Flows, AddressTools Premium allows you to configure an automated address verification process with no coding knowledge.

This article covers configuring a Salesforce Record-Triggered Flow to queue an address verification process on a record that invoked the flow. This produces a verified address within moments of the flow being triggered. It is dependant on Salesforce Future Methods so be aware that there is expected to be a slight lag between the record being inserted/updated and the address being verified.

Pre-requisites

The component used in the flow comes as part of the AddressTools Premium package. An additional purchase of address verification credits will be required.

If you’re new to AddressTools Premium, please contact info@provenworks.com with your Org ID to have the team enable your org for batch address verification. Without doing this your org will be unable to verify addresses.

With AddressTools Premium installed, the following configurations will require:

  • An address block to be configured in the AddressTools Administration page,
  • An address status field for the address block,
  • Verification enabled for the org and specifically the address block.

If you need assistance on any of the pre-requisites, please refer to the AddressTools Premium Installation Walkthrough before getting started.

Create a Record-Triggered Flow to verify addresses in Accounts

The following example is going to follow verifying the billing address block on accounts using a Record-Trigger Flow on insert and update. This process can be adapted to any object and address block of your choice assuming it’s configured with AddressTools.

  • Go to Salesforce Setup | Flow.
  • Select New Flow.
  • Choose Record-Triggered Flow.
  • Search and select the object that you are configuring the process for.
  • Set Trigger the Flow When to A record is created or updated.
  • Select Done.

Configure Start

  • Object Account
  • Set entry conditions.
  • Configure Trigger A record is created or updated.
  • Condition requirements All Conditions Are Met (AND).
  • We’ll choose the address status field configured with the address block. For this scenario: pw_ccpro__BillingAddressStatus__c Equals Not checked.
  • When to Run the Flow for Updated Records Every time a record is updated and meets the condition requirements.
  • Optimize the Flow For Actions and Related Records.
  • Done.

Configuring an Apex Action

  • Click the plus sign to add an element
  • Add Action| Filter By Type | Apex Action
  • Action: Premise-Level Address Verification
  • Label Verification of addresses
  • API Name Verification of addresses
  • Set Input Values
  • Country-Field API Name: BillingCountry (This value is the API name of the country field configured in the address block. For example, the Mailing Country on Contact would be MailingCountry).
  • ID of record to validate: {!$Record.Id} (This takes the record ID from the record that invoked the flow).
  • Done.

Save the Flow

  • Select Save in the top right.
  • Provide a Flow Label to help you identify the flow in the future.
  • The Flow API Name will autofill.
  • Click Save.
  • Activate the flow.

Testing the Flow

With the flow created and activated, we can now test it in the org.

Note: before testing the flow, we recommend ensuring you have the Batch Verification Alerts Email field populated in AddressTools Administration with your email address.

  • Go to a test account in the Org.
  • Edit the billing address.
  • Save the record.

This will invoke the flow and it may take a few seconds to return the status. If the address status field has not updated by the time the page refreshed, give it a moment and refresh the page.

Book a free demo

We love talking about all things address related! See AddressTools, our address data solution for Salesforce, on a free demo.

How to populate a state value from a US ZIP Code using a Salesforce flow

Reducing manual data entry results in better user adoption, less friction for prospects and overall a better user experience. 

In this example we are going to create a Salesforce flow that will fetch the State value from an entered US ZIP Code and populate the address’ state field. This removes the (often neglected!) requirement for end users to enter a State value at point of record entry. The ZIP Code data is part of AddressTools Premium which is available on the AppExchange.

Follow along with our step-by-step guide by installing a free two-week free trial of AddressTools Premium.

Create a flow to automate State population

  • Go to Salesforce Setup | Flow.
  • Select New Flow.
  • Choose Record-Triggered Flow.
  • Search and select the object that you are configuring the process for.
  • Set Trigger the Flow When to A record is created or updated.
  • Select Done.

Set entry conditions.

  • Condition requirements All Conditions Are Met (AND)
  • pw_ccpro__BillingCountryLookup__c Equals United States
  • BillingState Is Null TRUE
  • BillingPostalCode Is Null FALSE 
  • When to Run the Flow for Updated Records Every time a record is updated and meets the condition requirements
  • Optimize the Flow For Fast Field Updates 

The flow will now be ready to start adding elements to.

  • Select Get Records and drag it under the Start element
  • Label Get ZIP 
  • Object ZIP Code 

Set entry conditions.

  • Condition requirements All Conditions Are Met (AND) 
  • Name Equals {!$Record.BillingPostalCode}
  • How Many Records to Store Only the first record
  • How to Store Record Data Automatically store all fields 

Add another element.

  • Select Update Records and drag it under the Get Records element
  • Label Update Account
  • How to Find Records to Update and Set Their Values Use the account record that triggered the flow
  • Set Filter Conditions None-Always Update Record

Set Field Values for the Account Record.

  • BillingState {!Get_ZIP.pw_ccpro__State__r.Name}

Make sure the elements are connected and Activate your flow. 

Before:

After:

How can I run this for my historic data?

If you have existing records in Salesforce that you want to run this logic for check out our guide on how to run a mass update using Salesforce Flows.


AddressTools

Validate, standardize and verify your address data with our award-winning solution. Learn more and book a demo.

Address Verification Flow Component: Installation Walkthrough

The Address Verification Flow Component for Salesforce is an extension available for AddressTools Premium and is the perfect component for user registration, e-commerce checkouts and service cloud flows. It’s a Lightning Web Component (LWC) that can be quickly added to a Salesforce Flow Screen, or be wrapped in your own custom component to truly fit your needs and can be deployed in minutes.

To leverage this component your org must have AddressTools Premium installed from the AppExchange with Address Verification credits.

First-time initialization

Add to a Salesforce Flow Screen

Address Verification Flow Component: Add the component to a Flow Screen

Adding the component to a Flow Screen

The component can be dropped into a flow screen in a place of your choice. It is designed to use the same variable names as the standard Address component provided by Salesforce allowing you to quickly “hot-swap” your existing address component with the Address Verification component.

  • Navigate to your Salesforce Flow in Salesforce Setup.
  • Double click an existing Screen element to open its editor or add a new Screen to your flow.
  • Search for Address in the Component search.
  • Drag the Address Verification by ProvenWorks component into the flow screen.
  • Fill in the desired parameters to meet your requirements.

When you’re done, save your flow and you’re ready to go!


Back to the Address Verification Flow Component installation walkthrough

Address Verification Flow Component: 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 address verification service.

  • Go to App Launcher | Address Verification Flow Administration.
  • Use the Create Security Token button.
  • If you need to update the security token in the future (which can be required after a sandbox refresh), select Update Security Token.

Now that your organization can communicate with address verification service, you can move on to implementing the component in your environment.


Back to the Address Verification Flow Component installation walkthrough

PhoneTools: Queue a Screen Immediately with a Salesforce Flow

Automated phone screening functionality covered so far in this installation walkthrough will screen records nightly that have not yet been screened or have their Next Screen Due Date in the past. Whilst practical, this leaves a space of time between the record being inserted/updated where the numbers won’t be screened until the next nightly batch job or user interaction.

That’s where flows come in to fill the gap.

Create a flow to screen the record

  • Go to Salesforce Setup | Flow.
  • Select New Flow.
  • Choose Record-Triggered Flow.
  • Search and select the object that you are configuring the process for.
  • Set Trigger the Flow When to A record is created or updated.
  • Select Done.

The flow will now be ready to start adding elements to.

  • Select the Decision Logic and drag it under the Start element.
  • Label: Is NULL or Overdue
  • API Name: IsNULLorOverdue

Under New Outcome:

  • Label: True
  • Outcome API Name: True
  • Condition Requirements to Execute Outcome: Any Condition Is Met (OR)
  • Resource: {!$Record.pw_pss__NextPhoneScreenDue__c} Note: this field will be the Next Screen Due Date field which may be custom dependant on your configuration.
  • Operator: Is Null
  • Value: {!$GlobalConstant.True}
  • Select Add Condition
  • Resource: {!$Record.pw_pss__NextPhoneScreenDue__c}
  • Operator: Less Than or Equal
  • Value: {!$Flow.CurrentDate}
  • Select Done

The decision element will now be shown in the flow and needs connecting to the start element.

Select and hold the connecter point on the Start block and drag it to the Decision element. This will create a connection between the two elements.

Now we need to add the Phone Screening element to the flow.

  • Select the Action Interaction and drag it under the Decision element.
  • In Action, search for Phone Screening and select the suggested item.
  • Label: Screen Phone Numbers
  • API Name: ScreenPhoneNumbers
  • ID of Record to Screen: {!$Record.Id}
  • Select Done.

The Screen Phone Numbers element will now be shown in the flow and needs connecting to the Decision element where the outcome is True.

  • Select and hold the connecter point on the Decision block and drag it to the Screen Phone Numbers element.
  • A modal will appear with an Outcome option. Choose True.
  • Select Done.

The flow is now configured and ready to Save and Activate. Repeat this process for each object that needs the functionality enabling for.

Summary of the functionality

When inserting or updating a configured record in Salesforce, this flow will now queue a task to screen the record immediately. This functionality relies on Salesforce Future Methods. Due to this dependency the results may not always appear visible immediately after record insert or update and the page may need to be refreshed before the statuses update. It is still advised to rely on the automated batch job to pick up all overdue records on its nightly run.


Back to the PhoneTools installation walkthrough

PhoneTools: Bind the formula to a Field to Screen setting

Configure the setting

We’ve now created a formula field containing the containing the conditions for screening a record, and we should also now have our phone fields configured in the Fields to Screen settings.

To add the formula field to a Field to Screen setting:

  • Go to App Launcher | PhoneTools Administration.
  • Navigate to the Configuration tab.
  • Select Edit next to one of the Fields to Screen rows where the formula should be applied.
  • Search and select the formula under Formula Field.
  • Press Save.

When the setting has been saved, the formula value will be updated for any configured phone field on the same object that is enabled for screening.


Back to the PhoneTools installation walkthrough

SimpleImport: Single object insert, update or upsert

This article will cover:

  • What is the difference between insert, update and upsert.
  • Choosing an import type.
  • Using matching conditions with updates and upserts.

What is the difference between insert, update and upsert?

When importing data into Salesforce it is important to understand the difference between the three import types.

  • Insert – Only create new records in your Salesforce Org. 
  • Update – Only update existing records in your Salesforce Org. This is only possible where a single match to an existing Salesforce record is achieved.
  • Upsert – Where a match can be found (see Update above) perform an update, if no match then create a new record.

For update and upsert, SimpleImport introduces matching conditions to define logic for matching existing records. This will become available for use when using update or upsert and is covered in more detail later in this article.

Choosing an import type (single object)

You’ve chosen your object, you’re now ready to define what type of import you want to complete.

  • Select insert, update or upsert under Import Type.
  • If you have selected insert, press Next to continue.
  • If you have chosen update or upsert, continue reading Using matching conditions.

Using matching conditions

Updating and upserting into Salesforce couldn’t be easier with the quick-to-adopt matching conditions functionality in SimpleImport. For each object that has the import type set to update or upsert, use the matching conditions tool to define criteria to find existing records in your org. This can range from simply matching existing records by their Salesforce Record ID, or a combination of fields such as Last Name, Phone Number and Email Address.

When update or upsert is chosen, the matching conditions section will automatically create one row ready to complete. Let’s get started.

  • Under File Column, choose a column header from the file that contains the data you want to use for matching.
  • Under Salesforce Field, choose the field label that contains the data you want to match with.
  • To add more matching conditions, select Add Row and repeat the two steps above for each added row.

Note: the matching conditions query builder will create an AND query to find existing records. It must result in finding a single record.

Summary

With the import type chosen and matching conditions set, it’s time to move on to the field mapping. Continue to the next article.


Back to the SimpleImport User Guide

SimpleImport: Object selection and import settings (master-detail)

This article will cover:

  • Choosing related objects to import into.
  • Loading an existing mapping.
  • Import settings (Campaigns and Assignment Rules).

After uploading a file into SimpleImport use the Import to Salesforce action to navigate to the object selection and import settings page.

You have the option to import into a single object or two related objects. This article will cover importing in to two related objects (i.e. Account and Contacts) so we’ll be choosing an object from the Master and then the Detail select list.

  • Use the Master select list to choose the object you want to import data to.
  • Choose a related Detail object.

Loading an existing mapping

Before reading further, what is a “mapping” in SimpleImport?

Mappings contain a predefined configuration to complete a repeat import task. They are designed by users in your organization and specific to your usage.

It is important to note that you may not have any saved mappings if this is your first time using SimpleImport in which case you can skip this step however we will cover how to save a mapping later in this guide if you are looking to repeat your import task, or configure ManagedImport. Your system administrator may advise you on a mapping to select.

If you are aware of an existing mapping to load:

  • Ensure the Object selection contains the objects that have a mapping associated with them.
  • Use the Load mapping select list to search for the mapping name.
  • Select the mapping.

When the mapping has successfully loaded, the path will update at the top of the screen. You can now review the configuration and navigate straight to the import summary to start the job.

Import settings

SimpleImport comes bundled with some helpful import settings that are specific to certain objects in Salesforce. These settings are not mandatory and can be left disabled if you do not wish to use them.

Import to Campaign

If your object selection contains Contacts or Leads in either the master or detail selection, you can associate them with an active Campaign by using the Import to Campaign setting. A Campain Member record will be created for each Contact or Lead imported. Each Campaign Member will require a status value that can be defined in the import settings.

Note: This setting will be disabled if object selection doesn’t contain a supported object.

To use Import to Campaign:

  • Select Import to Campaign.
  • Search and select an existing active Campaign from the select list.
  • If you choose Specific status, use the select list and choose a pre-existing status value. This sets the same status value for each of the file’s rows.
  • If you choose Status from spreadsheet column, ensure there is a column in your spreadsheet and select its header. This option allows for a different status value for each of the file’s rows.
Use assignment rules

If your object section contains Cases or Leads in either the master or detail selection, you can assign the owner by following the configured Assignment Rules in Salesforce.

To use assignment rules with your import:

  • Select Use assignment rules.
  • If you wish to follow the active assignment rule from Salesforce, select Use active rule.
  • If you wish to use an alternative assignment rule, select its label.

Note: if the master and detail object selection both support assignment rules, two assignment rule options will be available labelled Master and Detail.

Summary

You should now be able to choose which objects you’d like to import to, load an existing mapping if one exists, and understand how to use Import to Campaign and Assignment Rules.

To continue on to choosing the import type (insert, update, upsert), select Next and move on to the next article in the guide.


Back to the SimpleImport User Guide

SimpleImport: Master-detail insert, update or upsert

This article will cover:

  • What is the difference between insert, update and upsert.
  • Choosing an import type.
  • Using matching conditions with updates and upserts.

What is the difference between insert, update and upsert?

When importing data into Salesforce it is important to understand the difference between the three import types.

  • Insert – Only create new records in your Salesforce Org. 
  • Update – Only update existing records in your Salesforce Org. This is only possible where a single match to an existing Salesforce record is achieved.
  • Upsert – Where a match can be found (see Update above) perform an update, if no match then create a new record.

For update and upsert, SimpleImport introduces matching conditions to define logic for matching existing records. This will become available for use when using update or upsert and is covered in more detail later in this article.

Choosing an import type (master-detail)

You’ve chosen your two related objects, it’s now time to choose the import types for each object.

Note: using update or upsert on a detail object import is considered an advanced import and should only be used if you’re confident in understanding the outcome.

When working with two objects, Step 1 and Step 2 will be presented in the UI.

  • Under Step 1, select insert, update or upsert under Import Type.
  • Select Step 2.
  • Select insert, update or upsert under Import Type.
  • If you have selected insert for both objects, press Next to continue.
  • If you have chosen update or upsert for either object, continue reading Using matching conditions.

Using matching conditions

Updating and upserting into Salesforce couldn’t be easier with the quick-to-adopt matching conditions functionality in SimpleImport. For each object that has the import type set to update or upsert, use the matching conditions tool to define criteria to find existing records in your org. This can range from simply matching existing records by their Salesforce Record ID, or a combination of fields such as Last Name, Phone Number and Email Address.

When update or upsert is chosen, the matching conditions section will automatically create one row ready to complete. Let’s get started.

  • Under File Column, choose a column header from the file that contains the data you want to use for matching.
  • Under Salesforce Field, choose the field label that contains the data you want to match with.
  • To add more matching conditions, select Add Row and repeat the two steps above for each added row.
  • Repeat these steps for both objects until all objects configured for an update or upsert have valid matching conditions.

Note: the matching conditions query builder will create an AND query to find existing records. It must result in finding a single record.

Summary

With the import type chosen and matching conditions set, it’s time to move on to the field mapping. Continue to the next article.


Back to the SimpleImport User Guide