Using the Salesbuilder sample application
Salesbuilder, shown in Figure 1, is a Sales Force Automation application written in Flex and deployed on the Adobe AIR runtime. It demonstrates local persistence using the embedded SQLite database, data synchronization, native drag-and-drop support, and direct chart manipulation.

Figure 1. Salesbuilder is a Flex application built
on Adobe AIR.
The following topics are covered in this article:
Initializing the encrypted database
Salesbuilder leverages the new database encryption capabilities available in Adobe AIR 1.5 to allow you to secure your local database.
The first time you start Salesbuilder, the application will generate the encrypted database on your local file system. Salesbuilder implements the key generation approach described in the section Using encryption with SQL databases in the manual Developing Adobe AIR Applications. The encryption key is based on a password provided by you and a SALT generated by the system. The password must be 8 to 32 characters long. It must contain at least one lowercase and one uppercase letter, and at least one number or symbol.
The next time you start Salesbuilder you will have to provide your password to access the encrypted database.
Note: To recreate the encrypted database: Delete the salesbuilder.db file in the application storage directory (C:\Documents and Settings\[USERNAME]\Application Data\salesbuilder.xxxxxx\Local Store on Windows; /Users/[USERNAME]/Library/Preferences/salesbuilder.xxxxxx/Local Store on Mac OS X), and restart Salesbuilder.
Initial data synchronization
To get started:
-
Download and install the applications. Start the application.
Note: If you have used a previous version of Salesbuilder,
click the Home button in the menu bar and click Initialize database. You can
then close the Tools dialog box.
- The sales pipeline dashboard is
empty. Click the Synchronization button next to "Welcome Christophe"
to populate the Dashboard.
If you prefer to use the AIR
SQL Admin tool, follow these steps to populate the dashboard:
- Start the AIR SQLite Admin tool
(download it here: http://coenraets.org/blog/2007/06/sqlite-admin-application-for-air/).
- Click Open Database.
- Navigate to your Application
Data\salesbuilder\Local Store (Windows) or ~/Library/Preferences/salesbuilder
(Mac) directory, select salesbuilder.db, and click Open.
- Click New Query in the menu bar.
- Type "select * from
account", "select * from contact", or "select
* from opportunity": no data.
-
In the Salesbuilder application,
click the Synchronization button in the menu bar. This will populate your local
database with server data. In this demo, the server data is read from
serverdata.xml.
Note: If the Dashboard or the Account Summary tabs are
open, the data will automatically be loaded in these screens after the synchronization
process completes.
- Click the Execute button again to
re-execute your query, and note that your local database has now been
populated.
Exploring the sales pipeline
You have the following options to
manipulate the sales pipeline features:
- Navigate along the time axis: Grab the background of the chart with your mouse and
scroll it left and write to navigate along the time axis.
- Zoom in and out: Grab a vertical grid line, and move it left and
right to zoom-out/zoom-in.
- Modify the pipeline directly: Grab a bubble with your mouse and move it up and
down or left and right to adjust the probability and the expected closing date
respectively. The projected revenue is automatically updated in the chart
title.
- Save data locally in real time: To verify that the new values are automatically
saved to the database, move a few bubbles, click the Synchronization button,
and then click Show Details button in the Offline Synchronization dialog box.
Note that the local changes to the opportunities are picked up by the synchronization
process. Alternatively, you can run the following query in the SQLite admin
tool: select * from opportunity.
- View details: Double-click a bubble to open a details view for the
opportunity.
Viewing the Search and Summary screens
Follow these steps to use the search functionality:
- Type a few letters in the
Salesbuilder search box (in the upper right corner); matching accounts,
contacts, and opportunities appear in a pop-up menu.
- Use the arrow keys to navigate in
the search results popup.
- Use the Enter key to open the
selected item.
Note: Alternatively, you can also open the summary screens
(Accounts, Contacts, and Opportunities
buttons in the menu bar), and open individual items from there.
Working with data
Follow these steps to learn how to work with data:
- In the Salesbuilder search box,
type Adobe (or simply A).
- Select the Adobe account from the
pop-up menu.
- Modify the Adobe information (for
example, change the phone number), and click Save.
- Click the Synchronization button
and then click Show Details. Notie that the change you just made is picked up
by the synchronization process.
- In the Contacts view of the Adobe
account tab, you can click an org chart item and move the org chart around.
- To open the details view for a
contact, either double-click an org chart item or click the Grid button (lower
left corner) and double-click a contact in the datagrid.
- Add a contact by clicking Quick
Contact in the lower right corner of the Contacts view. Make sure you select a
manager and click Save. Notice that the org chart is updated automatically.
- On the Market History view of the
Adobe account tab, you can grab the chart with the mouse and move it left and
right and adjust the time selection using the dividers in the bottom chart.
- On the News view of the Adobe
account tab, you can look at news for the selected account. (This feature
leverages the HTML component.)
- Continue to add and modify
accounts, contacts, and opportunities and click the Synchronization button to
see the changes being picked up by the synchronization process.
- At any point, you can go back to
the SQL admin tool and re-execute the query to show that the local database has
been updated.
Using native drag-and-drop support
Follow these steps to explore drag-and-drop support:
- Click the My Dashboard tab. (If
you have closed the Dashboard tab already, click the Dashboard button in the
menu bar.)
- Drag the dashboard title to the desktop—the
chart is saved as a JPG on the desktop. (Note: it may take a few seconds before
you actually see the drag icon.) Double-click the file to open it in your
default image viewer.
- Open a Word document, and then
drag and drop the dashboard in the Word document—the chart is embedded in the
document.
- Click the Opportunities button on
the Salesbuilder menu bar to open the Opportunity summary screen. Select some
rows in the datagrid, and, without releasing the mouse button, drag the
selected rows and drop them on the desktop. The rows are saved as an Excel
document on the desktop.
- Double-click the Excel document to
open the spreadsheet.
- Drag some rows from the datagrid
again, and, this time, drop them directly somewhere in the open Excel
spreadsheet.
Reinitializing the demo
To reinitialize your database and start with an empty db and
show the initial sync process, click the Home button and click Initialize
database.
About the author
Christophe Coenraets is a Technical Evangelist for Adobe where he focuses on rich Internet applications and enterprise integration. He has been working on Flex since the early days of the product in 2003. In his previous role at Macromedia, Christophe worked on JRun, the company's J2EE application server. Before joining Macromedia, Christophe was managing Java and Internet applications evangelism at Sybase. Christophe has been a regular speaker at conferences worldwide for the last 15 years. He blogs at http://coenraets.org.