Movie Cloudstock is finally here. Yesterday was a buzz of activity as the final signage was raised, the lab machines were configured, and yes, the Hackathon is under way (don't worry, you can still start now if you haven't already!) with some amazing prizes for the winners (Kavindra and I were were at the Salesforce offices last night at around 10pm loading them into a cab!). 


But yesterday wasn't all work, and play. I dropped into the Thirsty Bear to say hi to some of the developer community members including Jeff Grosse, Brandy Colmer, and more.

In the spirit of the Hackathon and sharing I was thinking this morning about some ideas for people looking to build a rocking app using One of the important aspects of Cloud 2 is the support for mobile, and location awareness (is that a word? Hey, it's 5am. Anything is a word at 5am if you ask me).  Could I combine sharing, and location?  I think so.

Sandeep helped me out the other day by sharing some code with me with a requirement for a demo (you will see it at Dreamforce, but I can't tell you any more that just yet!) which I wanted to share here in the hopes Hackathoners (another 5am word I know!) might be able to use it in their code.

My requirement was to populate records in with State codes based on a zips. We created a simple State_Zip_Mapping__c custom object to hold the mapping (you can Download the data here), then wrote a class which uses Batch Apex to loop through the records we want to update:


That's it. Now with a quick call to database.executeBatch from the console, I have just taken my Account records and mapped state codes to them.

If you end up using this code in the Hackathon, make sure you let us know. And of course, the bonus prize is who can the first person to correctly identify which movie the pic above came from? Yes, it's early I know……

Happy Coding!


Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS