
he growing popularity of Service Oriented Architecture (SOA) along with a growing dissatisfaction with the once touted application service provider (ASP) model have spurred the emergence of Software as a Service (SaaS) in the enterprise. With enterprises investing heavily in SOA, it is natural for them to extend the scope of enterprise capabilities they can provide as services. Why not entire software packages? On the other end, the economic rationale for consuming SaaS seems to be: Why should I purchase a solution when I can lease it and pay only for as much as I need?
Through the SaaS delivery model, the provider hosts and operates the software on its own servers, providing central support, management, and maintenance. Subscribers then access the software capabilities via the Internet using a Web portal, a thick client-side GUI, or XML-based web service invocation calls.
The use of these standard formats and protocols opens new opportunities for application development as well. With successful Customer Relationship Management (CRM) vendors such as Salesforce.com and NetSuite providing SaaS (or on-demand) development platforms, individual application developers and development teams can now build, test, and deploy SaaS modules and applications without the need to administer rooms full of servers.
Salesforce.com in particular has made a push into the developer space during the past year by providing access to some of the same tools that the Salesforce.com development team uses for building commercial SaaS products. This article explores SaaS application development by introducing Salesforce.com's Visualforce platform and Apex programming language, and then providing a tutorial for building a simple Salesforce.com application with these technologies.
A Primer on Visualforce and Apex
Creating custom SaaS applications for Salesforce.com (SFDC) used to require the manual development of S-Controls (components comprised of HTML and JavaScript) and extensive styling through the Salesforce CSS. Visualforce is a new technology from Salesforce.com that is aimed to provide a smoother and more powerful mechanism for creating and reusing custom user interfaces for Salesforce applications. In addition to being more powerful and easy to use than the traditional approach, they have the added benefit of promoting good design and component reuse through a clean separation between the business logic and interface involved in a custom page.
Apex is SFDC's Java-like scripting language aimed at enabling the extension of existing Salesforce.com applications. Apex enables a new breed of on-demand application, complete with business processes and application logic but without the need for local software.
Enhanced customization is another focus of the Apex language, allowing developers to modify existing Salesforce.com application behavior as well as create new behavior. Apex actually provides developers with access to the same tools that the Salesforce.com development team uses for building commercial SaaS products.
Apex enables the creation of triggers (to fire events when a user performs certain operations) and classes (housing business logic and procedural data-processing commands). Developers can reuse Apex as well as expose their classes as web services by adding a few simple keywords. Finally, this language provides direct access to UI elements (such as buttons and events) and even facilitates the creation of transaction semantics and flow control.
Build Your First Salesforce.com Application
The SFDC application sample you will build in this tutorial is a very basic invoice-payment management system. It will allow you to create an invoice for a specific amount that is to be paid over a set period of time. Once the invoice is created, the application automatically generates a payment schedule via Apex Code triggers and maintains the payment status (Past Due, Pending, and Paid) using a combination of SFDC's built-in workflow engine Apex Code triggers. The invoice screen itself is a Visualforce page that utilizes both Salesforce.com's native configurable page layouts and custom layout regions.
The first step you must take is signing up for a free Developer Edition account from Salesforce.com by joining the Apex Developer Network (ADN). Salesforce.com will e-mail you the account details and then grant you instant access.