Saturday, May 07, 2011

Google Maps in Salesforce - Bird Sightings cont.

Now that we have a Salesforce account, a Flex Google Map and a Salesforce page to embed that through a static resource, we'll move on to building up the objects that we're going to pull in. First things first, we build a new Custom Object that will hold the Latitude and Longitude of the Sighting. Every sighting occurs somewhere and that somewhere can be plotted on a map. Sightings imply that something has been seen, so you'll need to provide a lookup to some other object. I think that something is a definition of something and the instance is the sighting. That's easiest. Unless you think Avi the bird needs to be tracked individual - we'll assume you're tying to the definition.

So I have a Sighting object and here's that:



Now that we have that we should enter a record in that object and make sure we can query it back. I usually do this in system log first to make sure my query's good.



Now you've got a single record that comes back and you need to plug in to your swf the connection to Salesforce. First step is to understand the toolkit. I use a distributed library to connect rather than the api because it's easier. I like easy. Download the force-flex.swc from this link Now that you've got that, plug in the swc to your build path in Flex Builder (or using the sdk if you're so inclined but that's pain you can avoid by spending a bit)



now that you have the swc to recognize your components, pull in the xmlns tag and declare your salesforce connection component



Now you need to pass the parameters for the session and server url in order for the flex app to be able to query for salesforce data (and later, insert/update)



Then you need to query in the flex layer and demonstrate you've got data


and here's the one record

No comments: