The Salesforce Address Search Package is a powerful and scalable solution designed to automate address validation and standardization inside Salesforce. The package integrates Salesforce with OpenStreetMap/Nominatim APIs to validate address information, standardize State and Country values, and improve CRM data accuracy.
Using Apex callouts, Queueable Apex processing, fuzzy matching algorithms, and Salesforce State & Country picklists, the solution automatically updates validated address information in standard Salesforce fields. The package also maintains API request and response logs for monitoring and troubleshooting.
This enterprise-ready solution reduces manual effort, minimizes inconsistent address records, improves reporting accuracy, and helps organizations maintain clean and reliable customer data across Salesforce.

Package Components
The package contains the following components:
| Component Name | Type | Purpose |
| AddressValidationClass | Apex Class | Main address validation and API callout logic |
| FuzzyStr ingMatcher | Apex Class | Finds best matching State and Country values |
| StateCountryPicklistUtilityClass | Apex Class | Reads Salesforce State and Country picklists |
| NominatimISOQueueableGeneric | Queueable Apex Class | Performs asynchronous address validation and Lead updates |
| LeadTrigger | Apex Trigger | Automatically initiates address validation after Lead creation |
| JD Integration logs | Custom Object | Stores API request and response logs |
| AddressValidationClassTest | Test Class | Unit testing for AddressValidationClass |
| FuzzyStringMatcherTest | Test Class | Unit testing for fuzzy matching logic |
| StateCountryPicklistUtilityClassTest | Test Class | Unit testing for picklist utility logic |
| NominatimISOQueueableGenericTest | Test Class | Unit testing for Queueable Apex processing |
Package Installation Process:
Step 1 — Open Installation URL
Open the package installation URL in the browser.
https://login.salesforce.com/packaging/installPackage.apexp?p0=04tGC000007P3MD
Step 2 — Login to Salesforce
Login into the target Salesforce Org where the package needs to be installed.
The package can be installed in:
- Developer Org
- Sandbox Org
- Production Org
Step 3 — Start Package Installation
After login, the package installation page will open.
Select the following option:
Install for Admins Only
Click:
Step 4 — Approve Third-Party Access
Since the package performs external API callouts, Salesforce may ask for external website access permission.
Select:
Yes, grant access to third-party websites
Step 5 — Complete Installation
Wait until the installation process completes successfully.
After completion, Salesforce will display:
Package Installed Successfully
Verify Installed Components
Verify Installed Package
Navigate to:
Setup
→ Installed Packages
Verify:
Address Search
Version 5.0
Verify Apex Classes
Navigate to:
Setup
→ Apex Classes
Verify the following classes:
AddressValidationClassTest
- FuzzyStringMatcherTest
- StateCountryPicklistUtilityClassTest
- NominatimISOQueueableGenericTest
Verify Custom Object
Navigate to:
Setup
→ Object Manager
Search:
JD Integration logs
Verify fields:
| Field Name | Purpose |
| Json_Request | Stores API request |
| Response | Stores API response |
| Log_for | Stores log type |
Required Configuration
Enable State & Country Picklists
The package uses Salesforce State and Country picklists for validation.
Navigate to:
Setup
→ State and Country/Territory Picklists
Enable:
- State Picklists
- Country Picklists
This configuration is mandatory because the package uses:
User.CountryCode
Configure Remote Site Settings
The package performs external API callouts to OpenStreetMap/Nominatim APIs.
Navigate to:
Setup
→ Remote Site Settings
Create a new Remote Site.
Remote Site Name
OpenStreetMap
Remote Site URL
https://nominatim.openstreetmap.org
Click Save.
How the Package Works
The package works as an intelligent middleware layer between Salesforce and external address validation services.
The validation process follows the steps below:
- User enters address information
- Salesforce sends address details to AddressValidationClass
- Apex HTTP Callout is sent to OpenStreetMap API
- API returns matching address results
- JSON response is parsed
- Country and State values are extracted
- FuzzyStringMatcher identifies the best matching values
- Standardized results are returned
- Request and response logs are stored in JD Integration logs object
Address Validation Process Flow
User enters address information in custom Lead fields
(Billing_State_Text__c and Billing_Country_Text__c)
↓
Lead record is created in Salesforce
↓
LeadTrigger automatically executes after Lead creation
↓
NominatimISOQueueableGeneric Queueable Apex process starts asynchronously
↓
AddressValidationClass sends address details to the OpenStreetMap/Nominatim API
↓
API returns matching address results in JSON format
↓
JSON response is parsed and processed
↓
FuzzyStringMatcher identifies the best matching State and Country values
↓
Validated values are returned to Salesforce
↓
Standard Salesforce address fields are automatically updated
(State and Country)
↓
JD Integration logs stores API request, response, and validation details
How to Use the Package
Step 1 — Open Developer Console
Navigate to:
Setup
→ Developer Console
Step 2 — Open Execute Anonymous Window
Navigate to:
Debug
→ Open Execute Anonymous Window
Step 3 — Execute Validation Code
Step 3 — Execute Lead Validation Example
Paste the following code in Execute Anonymous Window:
Lead l = new Lead(
FirstName = ‘Aman’,
LastName = ‘Jain’,
Company = ‘Tiffin’,
Billing_State_Text__c = ‘Rajasthan’,
Billing_Country_Text__c = ‘India’,
PostalCode = ‘302017’
);
insert l;
Click Execute.
What Happens Internally
• LeadTrigger executes automatically after Lead creation
• Queueable Apex process starts asynchronously
• AddressValidationClass performs API callout to OpenStreetMap/Nominatim API
• FuzzyStringMatcher identifies the best matching State and Country values
• Salesforce standard fields are automatically updated:
• State
• Country
• API request and response logs are stored in JD Integration logs
Click Execute.
Expected Output
Expected Output After successful execution:
- Lead record is created successfully
- Address validation process starts automatically
- Standard Salesforce fields are automatically populated:
| Custom Input Field | Standard Salesforce Field |
| Billing_State_Text__c = Rajasthan | State = Rajasthan |
| Billing_Country_Text__c = India | Country = India |
• API request and response details are stored in JD Integration logs
Example Result:
| Field | Value |
| State | Rajasthan |
| Country | India |
The Lead record will contain standardized State and Country values after Queueable processing completes.
Please find all the test cases document here:(Test cases)
Address search testing doc.docx
Log Verification
Navigate to:
App Launcher
→ JD Integration logs
Verify the following information:
| Field | Description |
| Json_Request | API request URL |
| Response | API response |
| Log_for | Validation log type |
Benefits of the Package
Benefits of the Package
- Improves CRM address data quality
- Automates address validation inside Salesforce
- Automatically updates standard Salesforce State and Country fields
- Reduces manual address correction effort
- Corrects spelling mistakes and incomplete address information
- Standardizes address data across Salesforce records
- Supports global address validation using OpenStreetMap/Nominatim API
- Improves reporting and analytics accuracy
- Reduces duplicate and inconsistent address records
- Provides reusable Apex-based address validation utilities
- Supports asynchronous processing using Queueable Apex
- Stores API request and response logs for monitoring and troubleshooting
- Integrates with Salesforce State and Country picklists
- Supports scalable enterprise-level Salesforce implementations
Conclusion
The Address Search Package provides a scalable, reusable, and intelligent address validation framework for Salesforce using Apex callouts, Queueable Apex processing, fuzzy matching algorithms, and OpenStreetMap/Nominatim API integration.
The solution automates Lead address validation by allowing users to enter address details in custom fields and automatically updating Salesforce standard State and Country fields with validated and standardized values.
By combining Trigger automation, asynchronous Queueable processing, fuzzy matching logic, Salesforce State and Country picklists, and API request/response logging, the package helps organizations maintain clean, accurate, and standardized address data across Salesforce records.
The package improves CRM data quality, reduces manual validation effort, enhances reporting reliability, and provides a scalable enterprise-ready solution for address standardization and automation inside Salesforce.