Record Validation Apex API

Last published at: 2022-05-12 08:48:25 UTC
Delete

Use the Apex API code for Record Validation in your own customizations within Salesforce. Find all Apex API details below.


Methods

The following methods are available in the Record Validation Apex API.

Models

Status Codes

validateAddress(addressInput)

Allows you to validate an address.

Signature

global AddressValidationOutput_v1 validateAddress(AddressValidationInput_V1 addressInput)

Parameters
addressInput - Type: AddressValidationInput_V1

Return Value
Type: AddressValidationOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
 recordval.AddressValidationInput_v1 input = new recordval.AddressValidationInput_v1();
input.street = 'Velperweg 8';
input.country = 'NL';
input.note = 'demo';
 recordval.AddressValidationOutput_v1 output = api.validateAddress(input);
System.debug(LoggingLevel.DEBUG, output.advice);
System.debug(LoggingLevel.DEBUG, output.addresses.get(0).advice);

suggestAddress(addressSuggest)

Allows you to suggest an address based on partial input.

Signature

global AddressSuggestOutput_v1 suggestAddress(AddressSuggestInput_V1 addressSuggest)

Parameters

addressSuggest - Type: AddressSuggestInput_V1

Return Value

Type: AddressSuggestOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
recordval.AddressSuggestInput_v1 input = new recordval.AddressSuggestInput_v1();
input.query = 'Velperweg 8'; 
input.country = 'NL';
input.note = 'demo';
recordval.AddressSuggestOutput_v1 output = api.suggestAddress(input);
System.debug(LoggingLevel.DEBUG, output.suggestions.get(0));
System.debug(LoggingLevel.DEBUG, output.status);

completeAddress(addressInput)

Will return the complete address from a selected suggestion.

Signature

global AddressCompleteOutput_v1 completeAddress(AddressSuggestInput_V1 addressInput)

Parameters

completeAddress - Type: AddressCompleteInput_V1

Return Value

Type: AddressCompleteOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
recordval.AddressCompleteInput_v1 input = new recordval.AddressCompleteInput_v1();
input.query = 'Velperweg 8'; 
input.country = 'NL';
input.index = 0;
input.note = 'demo';
recordval.AddressCompleteOutput_v1 output = api.suggestAddress(input);
System.debug(LoggingLevel.DEBUG, output.address.advice);
System.debug(LoggingLevel.DEBUG, output.address.countryCode);

validateEmail(emailInput)

Signature

global EmailValidationOutput_v1 validateEmail(EmailValidationInput_V1 emailInput)

Parameters

validateEmail - Type: EmailValidationInput_V1

Return Value

Type: EmailValidationOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
recordval.EmailValidationInput_v1 input = new recordval.EmailValidationInput_v1();
input.email = 'demo@plauti.com';
input.note = 'demo';
recordval.EmailValidationOutput_v1 output = api.validateEmail(input);
System.debug(LoggingLevel.DEBUG, output.advice);
System.debug(LoggingLevel.DEBUG, output.status);

suggestEmail(emailInput)

Signature

global EmailSuggestOutput_v1 suggestEmail(EmailSuggestInput_V1 emailInput)

Parameters

suggestEmail - Type: EmailSuggestInput_V1

Return Value

Type: EmailSuggestOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
recordval.EmailSuggestInput_v1 input = new recordval.EmailSuggestInput_v1();
input.email = 'demo@plauti.com';
input.note = 'demo';
recordval.EmailSuggestOutput_v1 output = api.suggestEmail(input);
System.debug(LoggingLevel.DEBUG, output.suggestions.get(0));
System.debug(LoggingLevel.DEBUG, output.status);

validatePhone(phoneInput)

Signature

global PhoneValidationOutput_v1 validatePhone(PhoneValidationInput_V1 phoneInput)

Parameters

validatePhone - Type: PhoneValidationInput_V1

Return Value

Type: PhoneValidationOutput_V1

Example

recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
recordval.PhoneValidationInput_v1 input = new recordval.PhoneValidationInput_v1();
input.phoneNumber = '0031-345677733'; 
input.country = 'NL'; 
input.format = PhoneFormat_v1.INTERNATIONAL;
input.note = 'demo';
recordval.PhoneValidationOutput_v1 output = api.validatePhone(input); 
System.debug(LoggingLevel.DEBUG, output.advice);
System.debug(LoggingLevel.DEBUG, output.status); 
System.debug(LoggingLevel.DEBUG, output.phoneNumber);

AddressValidationinput_V1

Field Type Mandatory     Description
street String Yes
housenumber String

housenumberAddition String

state String

city String

postalcode String

country String Yes
note String    
This message is included in the transaction logging
addressOptions AddressOptions_v1

AddressOptions_v1

Field Type Mandatory Description
housenumber Boolean    

When you want to get the result of the validation with the house number addition not in the house number field.
default: false

housenumberAddition Boolean    

When you want to get the result of the validation with the house number not in the street field.
default: false

AddressValidationOutput_V1

Addresses

Field Type Mandatory Description
street string Yes
housenumber string

housenumberAddition string

state string

city string

postalCode string

country string Yes
countryCode string

fullAddress string

status Status_v1

advice Enum Advice_v1

Advice_v1

Field Type Mandatory Description
advice string
Enum: Green, Amber, Red

Status_v1

Field Type Mandatory Description
code string

message string

credit boolean

AddressSuggestInput_v1

Field Type Mandatory Description
address string Yes The partial input for the address search
country string
The country for which the address search should be done
index integer    

note string
This message is included in the transaction logging

AddressSuggestOutput_v1

Field Type Mandatory Description
suggestions string

status Status_v1

Status_V1

Field Type Mandatory Description
code string

message string

credit boolean

AddressCompleteInput_v1

Field Type Mandatory Description
address string Yes The partial input for the address search
country string
The country for which the address search should be done. (fallback to RV Setup Settings)
index integer Yes The list index items of the address selected. Starting with 0
note string
This message is included in the transaction logging

AddressOptions_v1

Field Type Mandatory     Description
housenumberAddition boolean    

When you want to get the result of the validation with the house number addition not in the house number field.
default: false

houseNumber boolean    

When you want to get the result of the validation with the house number not in the street field.
default: false

AddressCompleteOutput_v1

Field Type Mandatory Description
address Address_v1

Address_v1

Field Type Mandatory Description
street string

housenumber string

housenumberAddition string

state string

city string

postalCode string

country string

countryCode string

fullAddress string

status Status_v1

advice Advice_v1

Status_v1

Field Type Mandatory Description
code string

message string

credit boolean

Advice_v1

Field Type Mandatory Description
advice string 
Enum: Green, Amber, Red

EmailValidationInput_v1

Field Type Mandatory     Description
emailAddress string Yes The input email address
note string
This message is included in the transaction logging

EmailValidationOutput_v1

Field Type Mandatory Description
complete string
the complete email address
addressee string
the addressee part before the @ 
domain string
the domain part after the @
free boolean
is a free email address like gmail.com or yahoo.com
disposable boolean
is a disposable email address. Like mailinator
status Status_v1    

advice Advice_v1

Status_v1

Field Type Mandatory Description
code string

message string

credit boolean

Advice_v1

Field Type Mandatory Description
advice string
Enum: Green, Amber, Red

EmailSuggestInput_v1

Field Type Mandatory     Description
emailAddress string     Yes the Input email address. Could be partial like 'user@gm'
note string    
This message is included in the transaction logging

EmailSuggestOutput_v1

Field Type Mandatory Description
suggestions string

status Status_v1

Status_v1

Field Type Mandatory Description
code string

message string

credit boolean

PhoneValidationInput_v1

Field Type Mandatory Description
phoneNumber string Yes
country string

note string
This message is included in the transaction logging
Yes Format_v1  Yes

Format_v1

Field Type Mandatory Description
PhoneFormat string Yes Enum: E164, INTERNATIONAL, NATIONAL, RFC3966

PhoneValidationOutput_v1

Field Type Mandatory Description
phoneNumber string
The Correctly formatted and standardized phone number
status Status_v1

advice Advice_v1

Status_v1

Field Type Mandatory Description
code string

message string

credit boolean

Advice_v1

Field Type Mandatory Description
advice string
Enum: Green, Amber, Red