How to add a Google address picker field

Paul58
Tera Contributor

I have a requirement to implement a google search field in the NavUI and Agent Workspace.  The user should type a portion of and address and a dropdown list picker is shown below the search box.  When a user clicks an address in the list, that address is used to populate other fields in the screen.

How can this be achieved?  The ServiceNow built in Google Maps API does NOT provide such a field.  I do not want to see a google map, I only want a textual list of address places in a picker.

See attached image of a similar picker I built in another site.

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

You can use Google Place Autocomplete REST API to get address from the string.

https://developers.google.com/maps/documentation/places/web-service/autocomplete

This API accepts part of the address string and returns address JSON which you can parse from script include.

 

Regards,

Sachin

 

 

Yes I already have a script include that I can call in a client script through GlideAjax but I don't know how to implement this in a user friendly UI picker. 

I thought maybe I need to create a custom widget, but that only seems to work in the Service Portal.  I'm so lost here.

Call onchange client script for this field and use g_form.setValue('your_field_name',<response_returned_From_async_ajax_call>) .

 

Regards,

Sachin

What field type would you use, would it be a list field or a popup window?