|
SYS-CON.TV Webcasts
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Top Links You Must Click On
CF & Flex Using the Adobe Flex Toolkit for Salesforce.com
New integration opportunities
By: Stephen Rittler
Oct. 7, 2007 07:15 AM
In April 2007 Adobe and Salesforce.com announced the availability of the Flex toolkit for Apex, Salesforce.com's on-demand programming language and API for interaction with their hosted CRM solution. This toolkit makes it simple to build Flex applications that interact with your Salesforce.com database.
The API itself is rather simple. Using the toolkit you can execute query operations (create, update, delete), run full-text searches, pull back metadata on your Salesforce environment (tabs, controls, layout information), send e-mail messages, and work with the workflow engine. The most useful aspect of the API is the query operations, so we'll focus on that in the following sample application "sfQuery."
Getting Started Add a reference to the Salesforce namespace to your mx:Application tag as indicated below:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" To create a connection to the Salesforce.com servers, add this line of code to your application: <salesforce:Connection id="apex"/> That's the extent of the configuration of your application. We can now use the connection (referenced as "apex") to interact with the Apex platform.
SOQL: The Salesforce Object Query Language
Doing Stuff
private function login():void Our callback function is rather simple in this example - all we're doing is changing states. Now that we're logged in let's enter a quick SOQL query:
SELECT Account.Name, This query will retrieve all contacts for each account in our Salesforce database when the "Execute Query" button is clicked.
private function executeQuery():void The query() function takes an SOQL statement as the first argument and a callback function as its second. We'll pass the query off to the "apex" connection object and wait for a response. Stylistic comment: rather than define the callback in another function as I did with the loginResult function, I opted to define it inline as an anonymous function. Either method works; the decision as to which way you do this is purely personal. Once we get the data back we'll use the ObjectUtil class to dump out the returned object as a string in the larger text area. If the query failed, we'd get an error and no results would render. Just like that we now have a quick SOQL statement tester that can help us build our future Flex/Apex applications. Reader Feedback: Page 1 of 1
Enterprise Open Source Magazine Latest Stories . . .
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||