Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

Posted on by Microsoft Employee

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

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: How to use Google API to fetch all the cities worldwide in CRM

    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.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: How to use Google API to fetch all the cities worldwide in CRM

    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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use Google API to fetch all the cities worldwide in CRM

    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
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to fetch all the cities worldwide in CRM

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans