# Address Book

The address book is used as a way to pre-fill an address form from an existing address, without the user having to type it from scratch. Because Limio for Salesforce is only aware of addresses stored in Limio, this is the list that by default the flow retrieves.

The apex action Get Customer Addresses returns a list of addresses from the customer record in Limio, and stores the output in the flow variable CustomerAddresses.

<figure><img src="/files/DW1EsHWPe62MRA8P9vK4" alt=""><figcaption></figcaption></figure>

This step can be customised by passing additional addresses from other records in the org, for a more tailored experience based on the org setup. The output generated must be a

`List<i42as.CustomerAddress>`

where i42as is the namespace for Limio for Salesforce. The CustomerAddress apex class is a global class with the following properties

<figure><img src="/files/cZ7d87Vz11xVwXmqrqTO" alt=""><figcaption></figcaption></figure>

Learn more about the class here: [Global Apex Class: CustomerAddress](/integrations/using-limio-for-salesforce/address-mandatory-fields/apex-customeraddress.md)

Below is an example that returns an address book entry from the billing address fields on the account

```
List<i42as.CustomerAddress> addressToReturn = new List<i42as.CustomerAddress>();
List<Account> accounts = [SELECT FirstName, LastName, BillingCity, BillingCountry, BillingPostalCode, BillingState, BillingStreet, BillingBuildingNumber, BillingStreetName FROM Account WHERE Id=: caseRecord.AccountId LIMIT 1];
if (accounts.size() > 0) {
  i42as.CustomerAddress address = new i42as.CustomerAddress();
  address.FirstName = accounts[0].FirstName;
  address.LastName = accounts[0].FirstName;
  address.MailingStreet = accounts[0].BillingStreet;
  address.MailingCity = accounts[0].BillingCity;
  address.MailingPostalCode = accounts[0].BillingPostalCode;
  address.MailingState = accounts[0].BillingState;
  address.MailingCountry = accounts[0].BillingCountry;
  address.id = 'billingaddressid';
  address.label = accounts[0].BillingStreet + ' ' + accounts[0].BillingCity + ' ' +accounts[0].BillingPostalCode;
  addressToReturn.add(address);

  // building number and street name can be mapped from your custom field: 
  address.MailingBuildingNumber = accounts[0].customBillingBuildingNumber;
  address.MailingStreetName = account[0].customBillingStreetName;
}
```

The generated output can be stored on the CustomerAddresses variable of the flow, that is of the same type.

<figure><img src="/files/CFoghO9dGpeZytQJcIVF" alt=""><figcaption></figcaption></figure>

This variable can then be passed to components that use an address book, like the delivery address book or the payment method iframe.

<figure><img src="/files/r4jBkgjlA0zmqCvDdo9X" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.limio.com/integrations/using-limio-for-salesforce/address-mandatory-fields/add-addresses-to-address-book.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
