Google have changed their model where Client ID is only available for old Google Maps business plan holders and new Premium Plan holders (Client ID's start with "gme-"). Any new Google plan holder will likely use the API Map Key as Client ID is not available.
When an instance is configured to use an API Map key instead of a Client ID for Google Maps functionality, Google Map functions work within the instance except for the Geocoding Latitude and Longitude functionality which fails. This is because the Google request to obtain the Latitude and Longitude only caters for Client ID and not API Map Key.
Steps to Reproduce
To enable Latitude and Longitude functionality in the instance:
- Configure the "Table used by the map": /system_properties_ui.do?sysparm_title=Google%20Maps%20Properties&sysparm_category=Google%20Maps (NOTE: Default is "cmn_location")
- Enable the associated "get_lat_long" business rule.
- Enable the scheduled job "Process Geocoding Request"
- Go the location table (cmn_location)
- Update an address of a location record (Street or City or State or ZIP or Country)
- System logs will show the following error when attempting to update Latitude and Longitude.
*** Script [GoogleMapsHelper.google_getLatLong]: Unknown response: Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID, or the provided 'client' is not valid.
The script include "GoogleMapsHelper" and function "google_get_LatLong" constructs the URL request made to Google to obtain the Latitude and Longitude of the address.
var geo_auto = "google.maps.geocoding.automation";
var gl = new GSLog("google.maps.logging", "GoogleMapsHelper.google_getLatLong");
gl.logDebug("signing url: " + url_to_sign);
parms += "&signature=" + signature;
The construction of the request URL is only for Client ID and doesn't cater for the API Map Key.
The URL to make a request to Google using the API Map Key is:
For API Map Keys to work, update the following lines in the "GoogleMapsHelper" script include.
Before: var query = "address=" + addr + "&sensor=false&client=" + gs.getProperty("google.maps.client");
Before: parms += "&signature=" + signature;
This will now use the API Map Key for geocoding requests.