Book Image

Learning Force.com Application Development

By : Chamil Madusanka
Book Image

Learning Force.com Application Development

By: Chamil Madusanka

Overview of this book

Table of Contents (21 chapters)
Learning Force.com Application Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction to the Force.com platform


Salesforce.com established the company as a Customer Relationship Management (CRM) product vender in 1999. The Force.com platform, which is known as Salesforce.com's platform as a service (PaaS) product, was launched in 2007. Force.com is a cloud computing platform that allows for developers to quickly build, share, and run custom business applications over the Internet. When we are developing applications on the Force.com platform, we don't need any additional hardware, additional software, and configuration and maintenance (database and hardware) efforts. The Force.com platform provides three default application categories, which include applications of Salesforce.com CRM. The main categories are as follows;

  • Sales cloud: This is for the automated Sales processes of an organization. For example, from campaign management to lead capture and account to quote management, you can do everything related to Sales here. Sales cloud can be used for marketing, leads, opportunities, and maintaining new customers (Accounts and Contacts).

  • Service cloud: This is used for any kind of support application such as call center, customer support desk, and so on. It helps the organization to manage their support on the cloud.

  • Chatter: This is the collaboration tool of Salesforce CRM. It helps the organization to integrate back office work in to Salesforce.

The Force.com platform runs on Salesforce.com's infrastructures with the main architecture called multitenant architecture. For more details about multitenancy, read the Key features of Force.com platform subsection. The multitenant architecture allows us to build custom applications without purchasing hardware and software licenses and without having to worry about database maintenance. It provides a trusted, configurable and customizable, upgradable, able to integrate, and a secure platform to build our custom applications on.

Understanding the Force.com model

In traditional software development, we need to manage additional software and hardware, software licenses, networks, database configurations, and maintenance by ourselves. However, the Force.com platform provides these additional features in their cloud computing model. We need to pay only for the things we use, not for all the hardware and software. That's because we get the Force.com platform as a service.

The architecture of the Force.com platform

The preceding figure shows the overview of the Force.com platform. The following table shows you the difference between the traditional platform and the Force.com platform.

Traditional Platform

Force.com Platform

Supply the core services of Database access

Form builder (build complete and standard UIs)

Supply Containers for logic

Process builder

Supply Containers for presentation

Logic and presentation as a service (Apex and Visualforce for custom developments)

Need to use other software to create our app

Fully functional reporting and analytical tools

Additional components to run the data center

Security

All of this will end up with additional expenditure

Sharing model

 

Workflow and approvals

 

Full support for the integrations with existing systems

 

Full support for mobile devices

 

Can access the platform through a web browser

Key features of the Force.com platform

The following are the key features of the Force.com platform:

  • Multitenancy

  • Application services

  • Force.com metadata

  • MVC architecture

  • Programming language

  • Integration

  • Force.com sites

  • AppExchange

Multitenancy

Multitenancy is the major technology of the Force.com cloud platform. It is used to share the IT resources in a secure and cost-effective way. Let's consider a real-world example to understand the multitenancy. Let's think about a luxury apartment complex with some facilities such as a playground, a swimming pool, and a gymnasium. This apartment complex has multiple owners. Everyone owns a separate apartment and every owner uses the shared playground, the shared swimming pool, and the shared gymnasium. These facilities are equal to a single, shared stack of hardware and software. The apartment is equal to the instance of a single client (a tenant). Therefore, a client has their own apartment with shared facilities and privacy.

The multitenant architecture

There are some advantages of multitenancy, which are as follows:

  • User satisfaction

  • Cost reduction

  • Automatic upgrades

  • No maintenance

  • Enhanced quality

  • User retention

  • Application providers can reach the hosted application

  • Application providers can gather some information (such as errors and performance issues) of the application, which will be helpful to make further enhancements

  • An error can be incurred from a particular tenant, but the solutions will be received by all the users who use the application

Application services

In traditional software development projects, we have to build or integrate various additional support applications such as login, validations, e-mail functions, reporting, UI, testing, and integrations. You had to repeatedly build these kinds of additional support applications in different projects. The Force.com platform provides the majority of support applications, which are most commonly needed in developing today's business application. For example, the Force.com platform has various features to automate your business process such as reporting, workflow and approvals, e-mail, user authentication, and integrations. These services are common to many software projects. Therefore, we can build applications with more functionality and within a short time period.

Force.com metadata

With multitenancy, we get secure, fast, reliable, customizable, and upgradable applications. When it comes to custom extensions by multiple tenants, we need to track and keep tenant-specific customizations without affecting the core application. The metadata-driven architecture takes care of that. After multitenancy, metadata-driven architecture is the second most important architecture in the Force.com platform. All the configuration, customization, and coding in the Force.com platform are defined and available as XML. It can be extracted and imported via a set of web services. Simply, metadata is data about data. The metadata-driven model provides the following advantages:

  • Complex applications can be created by only using point-click developments (without any coding).

  • A developer can build the application with the end user experience but the elements of the application are automatically translated to the metadata at creation time.

  • Metadata provides a speedy development.

  • Customization and extensions can be done without affecting the end user.

  • Metadata can be used to construct an identical environment to use in another organization.

  • Metadata can be used to assist version controlling.

  • Metadata can be used for testing and troubleshooting by comparing multiple environments.

    The metadata architecture of Force.com

The preceding figure shows the metadata-driven architecture of Force.com. It creates the separation between the runtime engine, the application data, and metadata. The polymorphic application includes database tables, relationships, UI elements, pages, classes, and so on.

MVC architecture

The Force.com platform uses the Model View Controller (MVC) architectural pattern for developing an application:

  • Model: This defines the structure of the data. In Force.com, objects define the data model. Salesforce has designed the platform by mapping every entity to some object.

  • View: This defines how the data is represented. In Force.com, page layouts and Visualforce pages come under this category.

  • Controller: This defines the business logic. The rules and actions which manipulate the data control the view. In Force.com, apex classes, triggers, workflows, approvals, and validation rules are under this category.

Programming language

The Force.com platform provides its own set of programming language, mark-up language, query language, and search language.

Apex

Apex, the world's first on-demand language is considered as the programming language of the Force.com platform. Apex is object oriented and the syntax is similar to Java and C#. It allows developers to build the logic with the interaction of existing platform features. According to the MVC architecture, Apex falls into the controller because it is used to write the controller classes and triggers on the Force.com platform. Apex can be used to:

  • Create custom controllers/Controller extensions

  • Create triggers that are executed automatically in records such as insert, update, delete and undelete particular objects

  • Access and invoke external web services

  • Create batch jobs

Visualforce

Visualforce is an implementation of MVC architecture. In the Force.com platform, we can develop Force.com applications with custom objects and standard objects. Every object has a standard user interface with one or more page layouts. But we cannot use standard page layouts for complex requirements. Here, Visualforce comes into play.

Visualforce is a web-based user interface framework, which can be used to build complex, attractive, and dynamic custom UIs. Visualforce allows the developer to use standard web development technologies such as jQuery, JavaScript, CSS, and HTML5. Therefore, we can build rich UIs for any app, including mobile apps. We'll be discussing Visualforce with standard web development technologies and Visualforce for mobile in more depth later. Similar to HTML, the Visualforce framework includes a tag-based markup language.

SOQL

Salesforce Object Query Language (SOQL) allows us to fetch data from Saleforce objects. SOQL syntax is similar to SQL but simpler. For example, SOQL has the SELECT keyword but doesn't contain the INSERT or UPDATE keywords. It is different from SQL as SOQL doesn't have the JOIN keyword. SOQL can be used in Apex code and it provides a powerful feature to manipulate and process data in Apex code.

Tip

Salesforce objects are similar to database tables. This will be explained in the next couple of chapters.

SOSL

Salesforce Object Search Language (SOSL) allows us to search your organization's data from Salesforce objects by specifying a text expression, scope of field to search, list of objects and fields to retrieve, and conditions to select rows in the source objects.

Tip

SOQL is used to fetch data from a single object and SOSL is used to fetch data from multiple objects. More about SOSL and SOQL will be discussed in Chapter 7, Custom Coding with Apex.

Integration

The Force.com platform provides the facility to integrate with existing applications. There are various advantages of integrating, such as including external systems into our processes, syncing data from multiple sources, and accessing data in other systems. Using an open Simple Object Access Protocol (SOAP) web service, the Force.com API provides access to all the data stored in the application. There are integration benefits as follows:

  • By using Force.com technologies, it takes less time to integrate than traditional integrations

  • The Force.com platform-based API provides direct and low-level access to Salesforce application data and metadata

  • There are many options to choose integration technologies and solutions that fit into their existing system

  • Proven platform and integration

Force.com sites

Force.com sites allow us to create public sites using Salesforce.com data, Visualforce, and standard web technologies such as CSS, JavaScript, and jQuery. Force.com sites are directly integrated with the Salesforce organization and it doesn't require a user authentication using the Salesforce username and password. A Force.com site has the following features and benefits:

  • Data from selected organizations can be exposed to the public through your own domain URL

  • There are no integration issues because Force.com sites are hosted on Salesforce servers

  • It can be built using Visualforce pages

  • According to the requirement, you can enable or disable the user registration

AppExchange

With the preceding features, you can build different kinds of applications. But how can you publish and distribute these applications? AppExchange will do it for you. AppExchange is the place to submit your developed applications, which can be directly installed in the client's organization.

AppExchange—the destination for CRM and Force.com apps

Advantages of Force.com

When we use Force.com platform to build enterprise applications instead of traditional software development, we will gain the following advantages:

  • We don't need to buy, install, maintain, and configure hardware and software.

  • We can start customizations as soon as we buy the organization and user license.

  • We can rapidly build and customize the applications on the Force.com platform.

  • The Force.com platform has a simplified development model because it uses multitenant and metadata-driven architecture.

  • It has the feature of instant scalability.

  • Quarterly upgrades of Salesforce.com do not require any maintenance from the user.

  • We can use or build multiple applications on a single platform. This is dependent on which Salesforce edition you are using. In Salesforce, the limitations change from edition to edition.

  • This is a proven platform for business-critical applications.

  • The Force.com platform is more secure and reliable. To learn more about security and trust visit http://trust.salesforce.com/.