Google Maps - Business Rule to Populate Latitude & Longitude is not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019 11:06 AM
Has anyone recently enabled the Google Maps Plugin? We recently obtained an API Key from Google, turned on the Business Rule: get_lat_long & activated the Scheduled Job: Process Geocoding Request.
The Business Rule is not populating the lat & long in our Location table.
We found an older article in the Community (see link below) and tried the script in the article, it did not work either.
Does anyone who has recently enabled Google Maps have any tips they can share?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 10:09 PM
Can you try manually running the Scheduled Job, and check the System logs for any errors?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2019 11:08 AM
Has anyone recently enabled Google Maps and had success with the out-of-the box Business Rules?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2019 12:09 PM
Are you getting any errors in the logs? In your google api dashboard, are you seeing anything trying to make requests? Did you set your api key anywhere in servicenow?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2019 12:28 PM
We have not gotten any errors in the logs. And the API Dashboard does show activity. The only place we set the API key was in the Google Maps config page.
We are not using the field 'street' instead we are using two fields u_address and u_address2. The second field u_address2 mainly stores suite # and appt #.
I've replace var street = new String(current.street); with
var street = newString(current.u_address);
and the script still did not work.
Out of the box script:
if (current != null) {
var street = new String(current.street);
street = street.replaceAll("\r","");
street = street.replaceAll("\n"," ");
var address = encodeParm(street) + " " + encodeParm(current.city) + " " + encodeParm(current.state) + " " +
encodeParm(current.zip) + " " + encodeParm(current.country);
address = address.trim();
if (address.length > 0) {
var point=GoogleMapsHelper.google_queueRequest(address, current);
}
}
// encodes non-Latin characters
function encodeParm(parm) {
return GlideStringUtil.urlEncode(parm);
}