web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to use Google API to fetch all the cities worldwide in CRM

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

I want to add an Auto-complete feature on "City" field in CRM. So if user types "A" it should show all the cities in the world with that initial.

How should I accomplish that in CRM? Auto-complete part is doable but my question is how to get list of cities in the world?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    If you know about the auto complete feature, you may already know that the auto complete works on the source of teh list. You need to either have this list within your CRM as entities, or you need to have it hard coded or you need to get this list from some other external api.

    It is up to you how you you decide on the data source for the cities. You can refer below links to get some more idea about this-

    www.inogic.com/.../design-auto-complete-text-controls-in-dynamics-crm-2016

    gis.stackexchange.com/.../free-api-or-database-for-continent-country-city-region-state

    www.quora.com/How-can-I-get-cities-and-states-of-a-country-through-Google-API

    Hope this helps.

  • Community Member Profile Picture
    on at

    Hi Ravi, Thanks for the response.

    Yes I am looking for using google API and if there is any alternative to it for this.

    We don'T want it to be hard coded or do not have all cities listed in CRM as entity.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    You can't do this for CRM field directly but you can build a html web resource where you can try to connect to google api and then store selected city to internal CRM field.

    check these references may it will help you:

    stackoverflow.com/.../how-to-limit-google-autocomplete-results-to-city-and-country-only

    ubilabs.github.io/geocomplete

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi New Bee,

    You can achieve this with JavaScript that runs OnChange of the "City" field. The JavaScript will need to call an API with a list of cities such as the World Cities API, and use the information to populate the "City" field. The World Cities API returns city, state and country in JSON format.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans