Feature #3945
openUser Story: Integrate Places API for Lead Location
100%
Description
As a Sales User
I want to search and select valid places in New Jersey when entering a lead’s location
So that the lead’s address is accurate, standardized, and easy to manage.
Acceptance Criteria
API Integration
Integrate with a Places/Geocoding API (e.g., Google Places API, Mapbox, OpenStreetMap).
Restrict search results to New Jersey (USA).
Location Field (Lead Form)
In the Create Lead and Edit Lead forms, the Location field should provide autocomplete suggestions.
As the user types, call the Places API and show matching results (city, street, zipcode).
User can select a suggested place → field auto-fills with formatted address.
Data Storage
Save selected location details in the lead record:
Formatted Address
City, State, Zip
Latitude & Longitude (for future mapping)
Validation
Prevent saving a lead without a valid location selection.
If API fails, allow manual entry but flag as "unverified address".
Performance
Use debouncing (e.g., 300ms) on API calls to avoid excessive requests.
Handle errors gracefully (e.g., “Unable to fetch places, try again”).
Typing “Newark” in location field shows valid suggestions in New Jersey.
Selecting a suggestion fills in formatted address in the field.
Lead is saved with correct place details (address, lat, long, city, state).
Invalid/manual address shows warning but still saves as “unverified”.
API errors (e.g., network issue) display proper error message.
Related issues