Create Lookup Fields¶
Overview¶
Lookup fields link a record to the AddressTools reference data, so the country, state and ZIP code on an address point at real records rather than sitting on the record as text. That makes them reportable, and lets you pull through anything else held against those records.
Three lookup fields can be mapped on an address block: a country lookup, a state lookup and a ZIP code lookup. AddressTools can create all three for you, or you can create them by hand.
Note: The lookups depend on each other. The country lookup is required before a state lookup is set, and before a ZIP code lookup is set. A state lookup is also required for a ZIP code lookup outside the United States; for US addresses the ZIP code lookup is set from the country lookup alone. Create them in country, state, ZIP code order.
Option 1: Let AddressTools Create Them¶
This is the quickest route, and creates all three fields at once.
- Click the App Launcher to search for and select AddressTools Administration.
- Select Address Blocks from the left menu.
- Click the dropdown arrow on the far right of the row for your address block.
- Select Create Lookup Fields.
- Read the confirmation text, then click Yes.
AddressTools creates three fields on the object, named after the address block, for example Billing Country Lookup, Billing State Lookup and Billing ZipCode Lookup. The third field is named ZipCode rather than ZIP Code, which is how the generated label reads.
Note: This action is not available for address blocks that contain fields from another managed package. Create the fields by hand instead.
Set Field-Level Security¶
Fields created this way are not visible to your users until you say so. Repeat these steps for each of the three fields.
- Navigate to Setup > Object Manager.
- Select the object, then select Fields & Relationships.
- Select the new lookup field.
- Click Set Field-Level Security.
- Check Visible for the Profiles that need it.
- Click Save.
Option 2: Create Them by Hand¶
Create the fields yourself when the action above is unavailable, or when you only want some of the three.
- Navigate to Setup > Object Manager.
- Select the object holding the address block, then select Fields & Relationships.
- Click New.
- Choose Lookup Relationship as the data type and click Next.
- Under Related To, select Country, State or ZIP Code, then click Next.
- Enter a Field Label naming the address block and the object it looks up, for example
Billing Country Lookup. - Check the Field Name that Salesforce fills in for you, then click Next.
- Check Visible for the Profiles that need it, then click Next.
- You do not need to add the field to any page layouts, so click Next again.
- Click Save.
Repeat for each lookup field you need, following the country, state, ZIP code order.
Step 3: Map Them on the Address Block¶
However the fields were created, they have to be mapped on the block before AddressTools will populate them.
- Click the App Launcher to search for and select AddressTools Administration.
- Select Address Blocks from the left menu.
- Open the block for this address by using the dropdown to select Edit.
- Scroll to the Lookup Fields section.
- Set Country Lookup Field, State Lookup Field and ZIP Code Lookup Field to the fields you created.
- Click Save.
When the Lookups Are Populated¶
Lookup fields are populated whenever an address is edited, so they stay current as your users work.
For what the feature does and how to turn population on for your org, see Lookup Fields.