Accessibility
Christophe Coenraets

Christophe Coenraets

Adobe

Created:
19 May 2008
Modified:
17 November 2008
User Level:
All
Products:
Adobe AIR

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.

Salesbuilder application

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:

  1. 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.

  2. 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:

  1. Start the AIR SQLite Admin tool (download it here: http://coenraets.org/blog/2007/06/sqlite-admin-application-for-air/).
  2. Click Open Database.
  3. Navigate to your Application Data\salesbuilder\Local Store (Windows) or ~/Library/Preferences/salesbuilder (Mac) directory, select salesbuilder.db, and click Open.
  4. Click New Query in the menu bar.
  5. Type "select * from account", "select * from contact", or "select * from opportunity": no data.
  6. 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.

  7. 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:

  1. 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.
  2. Use the arrow keys to navigate in the search results popup.
  3. 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:

  1. In the Salesbuilder search box, type Adobe (or simply A).
  2. Select the Adobe account from the pop-up menu.
  3. Modify the Adobe information (for example, change the phone number), and click Save.
  4. Click the Synchronization button and then click Show Details. Notie that the change you just made is picked up by the synchronization process.
  5. In the Contacts view of the Adobe account tab, you can click an org chart item and move the org chart around.
  6. 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.
  7. 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.
  8. 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.
  9. On the News view of the Adobe account tab, you can look at news for the selected account. (This feature leverages the HTML component.)
  10. 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.
  11. 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:

  1. Click the My Dashboard tab. (If you have closed the Dashboard tab already, click the Dashboard button in the menu bar.)
  2. 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.
  3. Open a Word document, and then drag and drop the dashboard in the Word document—the chart is embedded in the document.
  4. 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.
  5. Double-click the Excel document to open the spreadsheet.
  6. 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.