Validate Address - Apex Flow Action

The Apex Flow Action "Validate Address" lets you validate and format an address inside a flow. The validation results can be saved to a record with the Save validation results Flow Action.

Due to Salesforce Governor Limits, this Flow Action can only be used for processing single records. If multiple records are provided the flow will fail.

This article explains how to validate an address in a flow. To save the validation results to a record afterwards, see article Save validation results.

1 Add the "Plauti Verify - Validate Address" action

  1. Open the Lightning Flow Builder.
  2. From the Elements section, drag a new Action to the screen from the Toolbox on the left side.
  3. In the 'New Action' dialog, search for Plauti Verify - Validate Address and select it.
  4. At Label, define a name for your action. If the API name is not set automatically, make sure an API name is defined as well.

2 Fill in the input values

  1. At Country, fill in the abbreviation of the country you want to use by default (for example, NL for "Netherlands" or US for "United States"). Plauti Verify needs this information to validate the address in the correct country.
  2. At FieldApiName, fill in the Street or Address Field API Name that is mapped in Verify Setup > Object Configuration > Object > Address tab.
    This way the flow knows for which address field the address should be validated.
  3. At Street or Address, switch to "Search Resources" and fill in the street or address you want to validate. This can be a variable coming from a screen component or a record field, for example.
  4. (Optional) At HouseNumber, fill in a variable or fixed value if you have a "House Number" field mapped in Verify Setup. If left blank, the house number is expected to be part of the address field itself.
  5. (Optional) At HouseNumberAddition, fill in a variable or fixed value if you have a "House Number Addition" field mapped in Verify Setup.
  6. (Optional) Fill in any other available input fields with variables or fixed values, or leave them blank.

If your "House Number" field is of type Number, note that this action returns the house number as text (to accommodate house numbers containing text, such as "6a"). If you want to store it in a Number field, use a formula with value(text) to convert it before storing it further in the flow.

3 Assign the validation result to a variable

  1. Check the Manually assign variables (advanced) checkbox.
  2. At Validation Result, click in the field and select + New Resource.
  3. At Resource Type, select Variable.
  4. At API Name, define an API name for the new variable.
  5. At Data Type, select Apex-Defined.
  6. At Apex Class, select recordval__Rv2FlowValidationResult.
  7. Click Done.
  8. (Optional) Assign Text variables to any other available output fields (for example, a formatted or standardized address) if you want to reuse them later in the flow, for example to store them on a record.
  9. Click Done.

The "Validation Result" variable holds the advice, status code, status message, and credit information for the validated address. This variable can be added to an Apex-Defined Collection Variable and used as input for the "Plauti Verify - Save validation results" flow action.

4 Connect your action to the start trigger

Make sure the "Plauti Verify - Validate Address" action is connected to the start trigger, together with any screen component or other source that supplies the address, and any follow-up actions such as "Plauti Verify - Save validation results".

5 Run the flow

Save the flow, give it a name and click Run.
When the flow runs, the entered address is validated, and the validation result becomes available in the assigned variable for use in the rest of the flow.