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)

auto fill fields by zip code

(0) ShareShare
ReportReport
Posted on by 250

Hello everyone my name is Taniguchi and im new at dynamics crm and i have a question.

i want create address fields who will be auto fill by zip code. how do i do that ?

*This post is locked for comments

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

    Hi,

    To auto populate you need to have the source data somewhere to auto populate. Assumin you are looking for auto populate address, you can follow the below blog to implement address auto complete functionality using google maps.

    syedhussain.net/dynamics-365-with-google-maps-for-address-lookup

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi,

    There is no OOB functionality for this in dynamics CRM.

    It's depends on which location CRM will be used . FInd the API first in google there are many third party service available in web which will give you  the address details on client side. You need to write JavaScript function to call the API on change event of field ZIP code and get the address details and set the all other address fields.

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Taniguchi ,

    How did you go with this? If the suggestion helped you then please mark it as helpful and close the thread.

  • TaniSantos Profile Picture
    250 on at

    Can vou recommend any site Where i can get the api information ?

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Which APi you are looking for? If you lookoing for Google Maps API key infor then check this: developers.google.com/.../get-api-key

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello ,

    Try with  link which Ravi shared in first post you can find below API used in source code-

    maps.googleapis.com/.../json; + postcode + '&sensor=false'

  • TaniSantos Profile Picture
    250 on at

    thanks so much for the help

  • TaniSantos Profile Picture
    250 on at

    the code its not working, could you help me ?

    function GetPostCodeValue() {

    var postcode = Xrm.Page.getAttribute("address1_postalcode").getValue();

    if (postcode != null) {

    FindAddress(postcode);

    }

    }

    function FindAddress(postcode) {

    jQuery.post('maps.googleapis.com/.../json; + postcode + '&sensor=false', function(r) {

    var lat = r['results'][0]['geometry']['location']['lat'];

    var lng = r['results'][0]['geometry']['location']['lng'];

    $.post('maps.googleapis.com/.../json; + lat + ',' + lng + '&sensor=false', function(address) {

    var address_number = address['results'][0]['address_components'][0]['long_name'];

    if (address_number != null) {

    Xrm.Page.getAttribute("address1_line1").setValue(address_number);

    }

    var address_street1 = address['results'][0]['address_components'][1]['long_name'];

    if (address_street1 != null) {

    Xrm.Page.getAttribute("address1_line2").setValue(address_street1);

    }

    var address_street2 = address['results'][0]['address_components'][2]['long_name'];

    if (address_street2 != null) {

    Xrm.Page.getAttribute("address1_line3").setValue(address_street2);

    }

    var city = address['results'][0]['address_components'][3]['long_name'];

    if (city != null) {

    Xrm.Page.getAttribute("address1_city").setValue(city);

    }

    //var city2 = address['results'][0]['address_components'][4]['long_name'];

    //var city3 = address['results'][0]['address_components'][5]['long_name'];

    var country = address['results'][0]['address_components'][6]['long_name'];

    if (country != null) {

    Xrm.Page.getAttribute("address1_country").setValue(country);

    }

    //var Postcode = address['results'][0]['address_components'][7]['long_name'];

    });

    });

    }

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Are you getting any error. If yes please share.

    Also, it would be good if you could create a new thread and share some more details. This makes the thread clean and related to the direct question.

  • TaniSantos Profile Picture
    250 on at

    sorry i am brazilian and i m not understand english very well, whar is a thread ?

    and about the code doenst appear an error message, but its not happening anything, its not auto populating.

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