The updated solution will work with the existing built-in entities as well as the custom entities.Here is the link to download the solution.
The solution consists of 4 files:
- 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 on onchange event of the field. The solution will retrieve postcode records related to entered postcode.
- If there is only one 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, the solution will prompt you to select the appropriate entry.
- Install the postcode solution.
- Open the CRM entity form in customization mode.
- Double click on attribute that represents the postalcode attribute.
- Add new_Json2.js and new_PostCodeScript to form libraries.
- Call loadPostCodeRequest function from new_PostCodeScript. Check the “Pass execution context as first parameter” and pass the 3 attributes that represent the city, state and country attributes in “Comma separated list of parameters that will be passed to the function” as shown in the following screen shot.
- Save the changes and publish the entity.
- Test the solution.