Validate Phone - Apex Flow Action

The Apex Flow Action "Validate Phone" lets you validate and format a phone number 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 a phone number in a flow. To save the validation results to a record afterwards, see article Save validation results.

1 Add the "Plauti Verify - Validate Phone Number" 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 Phone Number 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 Phone Number, switch to "Search Resources" and fill in the phone number you want to validate. This can be a variable coming from a screen component or a record field for example.

  2. At Country Code, fill in the country code for the phone number (for example, US). When left blank, the default country as configured in Verify Setup is used.

  3. At FieldApiName, fill in the Phone Field API Name that is mapped in Verify Setup > Object Configuration > Object > Phone.

    This way the flow knows for which phone field the phone number should be validated.

  4. (Optional) At Format, fill in the phone number format you want the validated number returned in. When left blank, the default formatting is applied.

  5. (Optional) At AutoProcessingScenarioName, fill in the name of a phone auto processing scenario if you want the entered phone number to be automatically processed based on the validation result. When left blank, no auto processing is applied.

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) At Formatted Phone Number, assign a Text variable if you want to reuse the validated and formatted phone number later in the flow, for example to store it on a record.
  9. (Optional) At AutoProcessedPhoneNumber, assign a Text variable if you want to reuse the auto processed phone number later in the flow.
  10. (Optional) Assign Text variables for Country and Phone Line Type if you want to reuse the detected country or phone line type later in the flow.
  11. Click Done.

The "Validation Result" variable holds the advice, status code, status message, and credit information for the validated phone number. 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 Phone Number" action is connected to the start trigger, together with any screen component or other source that supplies the phone number, 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 phone number is validated and formatted, and the validation result becomes available in the assigned variable for use in the rest of the flow.