Wednesday, June 29, 2011

CRM 2011 Postcode Lookup Solution Version 1.0

I have created this postcode lookup solution. You can download the managed solution from here. The name of the solution file is PostCodeSolution_1_0_managed. The solution consists of 4 files

  • new_Json2.js (Javascript webresource)
  • new_PostCodeScript(Javascript webresource)
  • new_postcode(custom entity to store postcode information)
  • new_SuburbOptions (HTML webresource)

How does it work:

  • User enters the postcode on postal code field and onchange event of the field, the solution will retrieve postcode records related to entered postcode.
  • If there is a record related to entered postcode, the solution will populate the state, suburb and country fields for you.
  • If there are more than one records related to entered postcode, solution will prompt you to select the appropriate entry.

In the following screen shot, I entered 2000 in postal code field and system prompt to pick the relevant city/suburb.



  • Clean data entry: The solution will help to minimise data entry errors in address fields.
  • Don’t need to create custom picklist state/or country attributes.
  • Using built-in address fields means, don’t need to modified some of the built-in reports.


  • The solution is working only address1_postalcode attribute of an entity. It can work on account , contact or any other entity that has built in address fields.
  • The solution is hard coded to fill built in adress1_city, address1_stateorprovince, address1_country fields only.

Version 2.0 :

I will release version 2.0 soon, which will not use hard coded attributes.

Installation Directions:

  1. Install the postcode solution.
  2. Open the account or contact entity form in customisation mode.
  3. Double click on Postal Code attribute.
  4. Add new_Json2.js and new_PostCodeScript to form libraries.
  5. Call loadPostCodeRequest function from new_PostCodeScript.Save the changes and publish them.


6. Import the Postcodes.


  • Import the file into new_postcode entity.

    Note: You can download the US postal Codes from US ZIP CODES.

    You are good to go.

    Feedback please.


  1. Hi..
    I am having trouble getting this script to work.
    If I implement as you write it says "The value of the property 'loadPostCodeRequest' is null or undefined, not a Function object".
    I am deploying on CRM 2011 online enviroment. Please advice.
    Rune Daub

  2. Hi Rune,

    I update the solution file. Try it again. It will work this time.
    Just make sure you are referring new_PostCodeScript without "s" at the end and not new_PostCodeScrips.

  3. Now getting an error saying:
    "Unable to get value of the property 'getEventSource' is null or undefined"

  4. Hi Rune,

    I tested this solution on CRMOnline and its's working perfectly fine. There must be some other issue.

  5. HI, I tried this in a 2011 online install and when the onchange kicks in, it gives the following error:
    There was a problem with this field's customized event.
    Error:'undefined' is null or not an object

    Any clues, thank you, Angus

  6. Sorry, last post I meant On Premise install!.

  7. We got the same error with our On-Premise Install.

    Error:'undefined' is null or not an object

    When changing the event handler and enabling (ticking) the "Pass execution context as first parameter" the error changes to the following:

    Error:Access is denied

    Any clues Singh ??????????

  8. Hi Try using the proper url to start a crm like
    Don't use http://localhost:5555/crm.
    It takes a bit of a time the first time. After that it will be ok.

  9. Change the event handler and tick the "Pass execution context" as first parameter

  10. Hi, we could use this if it was using configurable attributes and worked with UK postcode data.

    How is that version 2.0 coming on or has development stopped


    1. Hi Paul,

      I think, I already sent you an email about it. I will post the code in April.


  11. Microsoft Dynamics CRM training will help you manage and prioritize your business goals, customize.we teach MS Dynamics CRM training and class available at Hyderabad.

  12. Hi,

    Will this work with a US version of CRM 2011 online after the latest update on 10 Jan 2013?


    1. Yeah It should work with all versions of CRM2011.

  13. HI When I Update an existing record and when changing the Postcode - I get the Pop up with the suburb list and when selected it updates the reqquired fields except for City. City field is blank . Kindly advice.