Retrieve Input & Output
Find & Retrieve address
The retrieveAddress
method retrieves a fully detailed address based on a container identifier provided by the findAddress
method. This allows for fetching structured address data after an initial search.
This method is used in conjunction with the findAddress
API to finalize address selection and ensure data accuracy.
Method Signature
Method name: retrieveAddress
global AddressRetrieveOutput_v1 retrieveAddress(AddressRetrieveInput_V1 addressInput)
Parameters
The AddressRetrieveInput_v1
object is used to retrieve a fully structured address using a container ID obtained from the findAddress
method.
Type | Variable | Description |
---|---|---|
AddressRetrieveInput_v1 | addressInput | The input object containing the container identifier to retrieve details. |
Output
The AddressRetrieveOutput_v1
object contains a fully structured address with details such as street, city, postal code, and geolocation information.
Type | Variable | Description |
---|---|---|
AddressRetrieveOutput_v1 | output | The result object containing the full address details. |
Save Validation Result
Does not work (yet) for AddressRetrieveOutput_v1.
The saveValidationResult
method allows to save the outcome of an address validation (status, status message, advice) directly to a Salesforce record, ensuring the results are easily accessible and tied to the appropriate record. For implementation details, see the saveValidationResult Class Reference
Apex Example
This Apex example retrieves a detailed address using a container ID from findAddress
, logs the results, and ensures structured address data is available for further processing.
// Initialize the Record Validation API
recordval.RecordValidationAPI_v1 api = new recordval.RecordValidationAPI_v1();
System.debug('Record Validation API initialized.');
// Create the AddressRetrieveInput object
recordval.AddressRetrieveInput_v1 retrieveInput = new recordval.AddressRetrieveInput_v1();
retrieveInput.container = 'GB|RM|B|728895'; // Example container from findAddress output
retrieveInput.note = 'Testing the Retrieve API'; // Custom note for display in the transaction log
System.debug('Address Retrieve Input prepared: ' + retrieveInput);
// Execute the retrieveAddress method
recordval.AddressRetrieveOutput_v1 retrieveOutput;
try {
retrieveOutput = api.retrieveAddress(retrieveInput);
System.debug('Full address details retrieved successfully.');
} catch (Exception e) {
System.debug('Error during address retrieval: ' + e.getMessage());
return;
}
// Log the retrieved address details
if (retrieveOutput != null && retrieveOutput.address != null) {
System.debug('Retrieved Address Details:');
System.debug('Street: ' + retrieveOutput.address.street);
System.debug('House Number: ' + retrieveOutput.address.housenumber);
System.debug('City: ' + retrieveOutput.address.city);
System.debug('Postal Code: ' + retrieveOutput.address.postalCode);
System.debug('Country: ' + retrieveOutput.address.country);
} else {
System.debug('No address details returned.');
}
Updated 17 days ago