Lightning Web Component for a using the Google Place API. Can be used in Lightning Experience and Flows.
It enhanced the OOTB Salesforce Google location, supporting better control about what to return to what field. Also can be included in flows (not current possible OOTB).
You can specify filters for countries to search for and also if you want to retrieve the Country and State short codes or long codes. Particularly useful if you enable State and Country/Territory Picklists
.
It fixes the issue when is not populating the city in the City field for UK addresses (I believe there are other countries as well).
It also fixes the issue that for some address will not get the alpha of the number of the house when getting the details (e.g. you search for 10a, you select the 10a record but when it populates the street it strips out the a leaving only the 10).
It supports the suburb for New Zealand addresses (and other countries with suburbs, cities and states). You can specify a custom field for Suburb (Billing_Suburb__c e.g.) or you can return the suburb in the City (BillingCity e.g.) field and the City in the State field (BillingState e.g.)
You can use this component in Record Pages and Flow screens.
You need to add the Google API Key into the API Key field
in the Places API
record of the Google Address Finder Settings Custom Metadata
.
Documentation on how to get an API Key from Google can be found here: https://developers.google.com/maps/documentation/places/web-service/get-api-key
Targets are:
- lightning__RecordPage
- lightning__FlowScreen
Label | Property Name (in XML) | Description | Type | Required | Default Value | Options | Supported in |
---|---|---|---|---|---|---|---|
Show inside an accordion? | showInAccordion | Show the Component inside an accordion or just in a card. | Boolean | true | true | lightning__RecordPage | |
Accordion Title | accordionTitle | Title to show in the accordion (only if show in accordion is checked) | String | false | Address Information | lightning__RecordPage | |
Default Opened? | defaultOpen | Open the accordion by default (only if show in accordion is checked) | Boolean | true | true | lightning__RecordPage | |
Number of Columns | numberOfColumns | How many columns to show? | String | true | 2 | 1,2 | lightning__RecordPage |
Search First Address Required? (Search Address Required? in Flows) | requiredSearch1 | Is a search required for the First Address? | Boolean | true | true | lightning__RecordPage, lightning__FlowScreen | |
First Field Label (Main Field Label in Flows) | labelToShow1 | Label of the First Field | String | true | lightning__RecordPage, lightning__FlowScreen | ||
First Street Field | streetField1 | API name of the First Street Field | String | true | lightning__RecordPage | ||
Street First Address Required? (Street Address Required? in Flows) | requiredStreet1 | Is the Street required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First Suburb Field | suburbField1 | API name of the First Suburb Field | String | true | lightning__RecordPage | ||
Suburb First Address Required? (Suburb Address Required? in Flows) | requiredSuburb1 | Is the Suburb required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First City Field | cityField1 | API name of the First City Field | String | true | lightning__RecordPage | ||
City First Address Required? (City Address Required? in Flows) | requiredCity1 | Is the City required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First State/Province Field | stateField1 | API name of the First state Field | String | true | lightning__RecordPage | ||
State/Province First Address Required? (State/Province Address Required? in Flows) | requiredState1 | Is the State/Province required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First Postal Code Field | postalCodeField1 | API name of the First Postal Code Field | String | true | lightning__RecordPage | ||
Postal Code First Address Required? (Postal Code Address Required? in Flows) | requiredPostalCode1 | Is the Postal Code required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First Country Field | countryField1 | API name of the First Country Field | String | true | lightning__RecordPage | ||
Country First Address Required? (Country Address Required? in Flows) | requiredCountry1 | Is the Country required for the First Address? | Boolean | false | lightning__RecordPage, lightning__FlowScreen | ||
First Place Id Field | placeIdField1 | API name of the First Place Id Field | String | false | lightning__RecordPage | ||
First Latitude Field | latitudeField1 | API name of the First Latitude Field | String | false | lightning__RecordPage | ||
First Longitude Field | longitudeField1 | API name of the First Longitude Field | String | false | lightning__RecordPage | ||
Show First Address Map? (Show Map? in Flows) | showMap1 | Show a static map of the First address | Boolean | true | true | lightning__RecordPage, lightning__FlowScreen | |
Allow edition First Address? | editEnabled1 | Is the edition of the First Address enabled? | Boolean | true | true | lightning__RecordPage | |
Edit First Address always enabled? | editAlwaysEnabled1 | Is the edition of the First Address always enabled? | Boolean | true | false | lightning__RecordPage | |
Show Buttons First Address? | showButtons1 | Show the Save and Cancel buttons for the First Address? | Boolean | true | true | lightning__RecordPage | |
Disable Individual Fields for First Address? | disabledInputsWhenFound1 | Disable the individual field when an address was found for the First Address? | Boolean | true | true | lightning__RecordPage | |
First Address Country Filters (Country Filters in Flows) | countryFilters1 | Comma separated list of Countries (2 digit) to filter the results for the First Address. Maximum 5. | String | false | lightning__RecordPage, lightning__FlowScreen | ||
Use Country and State Short Codes for First Address? (Use Country and State Short Codes for Address? in Flows) | stateAndCountryShortCodes1 | Do we need to populate short codes for country and state for the First Address? | Boolean | true | false | lightning__RecordPage, lightning__FlowScreen | |
Second Address Required? | required2 | Is the Second Address required? | Boolean | true | false | lightning__RecordPage | |
Second Field Label | labelToShow2 | Label of the Second Field | String | false | lightning__RecordPage | ||
Second Street Field | streetField2 | API name of the Second Street Field | String | false | lightning__RecordPage | ||
Street Second Address Required? | requiredStreet2 | Is the Street required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second Suburb Field | suburbField2 | API name of the Second Suburb Field | String | true | lightning__RecordPage | ||
Suburb Second Address Required? | requiredSuburb2 | Is the Suburb required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second City Field | cityField2 | API name of the Second City Field | String | false | lightning__RecordPage | ||
City Second Address Required? | requiredCity2 | Is the City required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second State/Province Field | stateField2 | API name of the Second state Field | String | false | lightning__RecordPage | ||
State/Province Second Address Required? | requiredState2 | Is the State/Province required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second Postal Code Field | postalCodeField2 | API name of the Second Postal Code Field | String | false | lightning__RecordPage | ||
Postal Code Second Address Required? | requiredPostalCode2 | Is the Postal Code required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second Country Field | countryField2 | API name of the Second Country Field | String | false | lightning__RecordPage | ||
Country Second Address Required? | requiredCountry2 | Is the Country required for the Second Address? | Boolean | false | lightning__RecordPage | ||
Second Place Id Field | placeIdField2 | API name of the Second Place Id Field | String | false | lightning__RecordPage | ||
Second Latitude Field | latitudeField2 | API name of the Second Latitude Field | String | false | lightning__RecordPage | ||
Second Longitude Field | longitudeField2 | API name of the Second Longitude Field | String | false | lightning__RecordPage | ||
Show Second Address Map? | showMap2 | Show a static map of the Second address | Boolean | true | true | lightning__RecordPage | |
Allow edition Second Address? | editEnabled2 | Is the edition of the Second Address enabled? | Boolean | true | true | lightning__RecordPage | |
Edit Second Address always enabled? | editAlwaysEnabled2 | Is the edition of the Second Address always enabled? | Boolean | true | false | lightning__RecordPage | |
Show Buttons Second Address? | showButtons2 | Show the Save and Cancel buttons for the Second Address? | Boolean | true | true | lightning__RecordPage | |
Disable Individual Fields for Second Address? | disabledInputsWhenFound2 | Disable the individual field when an address was found for the Second Address? | Boolean | true | true | lightning__RecordPage | |
Second Address Country Filters | countryFilters2 | Comma separated list of Countries (2 digit) to filter the results for the Second Address. Maximum 5. | String | false | lightning__RecordPage | ||
Use Country and State Short Codes for Second Address? | stateAndCountryShortCodes2 | Do we need to populate short codes for country and state for the Second Address? | Boolean | true | false | lightning__RecordPage | |
FROM HERE DOWN IS JUST FOR FLOWS | |||||||
Allow Search? | searchEnabled | Is the Google Search Address enabled?. INPUT ONLY. | Boolean | true | true | lightning__FlowScreen | |
Disable the Individual Fields | disabledInputs | Disable the inputs of the individual fields when the address is found. INPUT ONLY. | Boolean | true | false | lightning__FlowScreen | |
Hide the Individual Fields? | hideEditFields | Hide the individual fields for edition. INPUT ONLY. | Boolean | true | false | lightning__FlowScreen | |
Show Suburb? | showSuburb | Show the Suburb field in the UI. INPUT ONLY. | Boolean | true | false | lightning__FlowScreen | |
Show State? | showState | Show the State field in the UI. INPUT ONLY. | Boolean | true | true | lightning__FlowScreen | |
Street | streetInput | Street default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Suburb | suburbInput | Suburb default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
City | cityInput | City default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
State/Province | stateInput | State/Province default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Postal Code | postalCodeInput | Postal Code default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Country | countryInput | Country default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Place Id | placeIdInput | Place Id default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Latitude | latitudeInput | Latitude default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Longitude | longitudeInput | Longitude default value. INPUT ONLY. | String | false | lightning__FlowScreen | ||
Street | streetOutput | Street returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Suburb | suburbOutput | Suburb returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
City | cityOutput | City returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
State/Province | stateOutput | State/Province returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Postal Code | postalCodeOutput | Postal Code returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Country | countryOutput | Country returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Place Id | placeIdOutput | Place Id returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Latitude | latitudeOutput | Latitude returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen | ||
Longitude | longitudeOutput | Longitude returned from Google Places API. OUTPUT ONLY. | String | false | lightning__FlowScreen |
IMPORTANT NOTE: This component requires that you either specify a Suburb Field
and/or a State Field
.
If you want to support my work, feel free to buy me a coffee 😀
Live Demo on a Scratch Org: CLICK HERE