The following features are available for the Address Autocomplete fields:
Status
Release Available |
Status |
Framework Name |
---|---|---|
2.8 |
Current |
TBC |
General
-
Get Google API key
-
Add the URL to the whitelist of Google API key
-
Add the following line to the VF page
Example 5. Code JSON
<script src="https://maps.googleapis.com/maps/api/js?key=your+key&libraries=places"></script>
-
addressComponentRestrictions is optional.
-
addressComponent types can be found athttps://developers.google.com/maps/documentation/geocoding/intro#Types
https://developers.google.com/maps/documentation/geocoding/intro#Types
Example 6. Code JSON
{"fields": [{ "id": "31ad", "fieldName": "address", "fieldUi": { "fieldType": "addressAutocomplete", "addressComponentMapping": [{ "addressComponent": "street_number", "fieldName": "address" }, { "addressComponent": "route", "fieldName": "address" }, { "addressComponent": "locality", "fieldName": "city" }, { "addressComponent": "administrative_area_level_1", "fieldName": "state" }, { "addressComponent": "country", "fieldName": "country" }], "addressComponentRestrictions": {"country": ["in"]} } }, {"id": "2bd5", "fieldName": "city", "fieldUi": { "fieldType": "string", "label": "City" }}, {"id": "daeb", "fieldName": "state", "fieldUi": { "fieldType": "string", "label": "State" }}, {"id": "27a0", "fieldName": "country", "fieldUi": { "fieldType": "string", "label": "Country"}} ]...
-
"formatted_address" is a special address component, including the complete suggested address
Example 7. Code JSON
"fieldUi": { "fieldType": "addressAutocomplete", "addressComponentMapping": [ { "addressComponent": "formatted_address", "fieldName": "Home_Address" }, { "addressComponent": "street_number", "fieldName": "Street_Number" }, { "addressComponent": "route", "fieldName": "Street_Name" }, { "addressComponent": "locality", "fieldName": "City" }, { "addressComponent": "administrative_area_level_1", "fieldName": "State_Address" }, { "addressComponent": "postal_code", "fieldName": "Postal_Code" } ], "addressComponentRestrictions": { "country": [ "aus" ] } }
Status
Release Available |
Status |
Framework Name |
---|---|---|
3.3 |
Current |
TBC |
General
-
addressTypes
-
By default, if nothing is specified, the addressTypes are
["address"]
because address instructs the Place Autocomplete service to return only geocoding results with a precise address.
-
All the values listed in the above link can be used.
Code JSON
{ "fieldUi": { "fieldType": "addressAutocomplete", "addressComponentMapping": [...], "addressComponentRestrictions": {...}, "addressTypes": ["geocode"] } }