You need to sign in to do that
Don't have an account?
saurabh8singh
postcode lookup field.
Hi All
I have a requirement of creating a PostCode field on lightning experience. Whenever anyone enters a 4 digit Australian postcode into this field, it should be able to pull suburb name matching to that postcode. There are more than 3k suburbs in a single state.
I can thought of a solution where I need to write an GET API to Australian Post (Auspost provides free api for search based on postcodes) which will return a JSON response having suburb details.
Can anyone provide their thoughts on this requirement or if anyone has worked on such requirement.
Any help on this is much appreciated.
I have a requirement of creating a PostCode field on lightning experience. Whenever anyone enters a 4 digit Australian postcode into this field, it should be able to pull suburb name matching to that postcode. There are more than 3k suburbs in a single state.
I can thought of a solution where I need to write an GET API to Australian Post (Auspost provides free api for search based on postcodes) which will return a JSON response having suburb details.
Can anyone provide their thoughts on this requirement or if anyone has worked on such requirement.
Any help on this is much appreciated.
With 4 digits, there's a maximum of 10,000 possible postal codes. This used to be a use case for Custom Settings, but Salesforce is now discouraging the use of List Custom Settings in favor of Custom Metadata records. So, if you can obtain a complete list of postal code / suburb data, you could define a simple Custom Metadata Type and create 10,000 (or however many there actually are) records. The advantage to Custom Metadata is that you can deploy it (via Change Set or other deployment methods), unlike data, which has to be loaded with Dataloader or the Import Wizard. And it doesn't count against data storage.
The other option is to create a Custom Object and import 10,000 records. That will eat 20 MB of data storage, and the data will need to be loaded into sandboxes everytime they're created / refreshed.
Finally, the callout will always be up-to-date. The metadata will have to be updated periodically as postal codes change. Which raises a question: if a suburb's postal code changes, how will you update existing records?
Thanks for your reply. Even I thought of creating custom metadata and use that but how to create 10000 records in the metadata object. Salesforce does not allow it using dataloader I guess. Any thoughts on creating 10000 records ??
Before:
The code:
After:
Let me know if you think this could work for you.