Book Image

Visualforce Development Cookbook

By : Keir Bowden
Book Image

Visualforce Development Cookbook

By: Keir Bowden

Overview of this book

Visualforce, in conjunction with Apex, makes it easy to develop sophisticated, custom UIs for Force.com desktop and mobile apps without having to write thousands of lines of code and markup. The "Dynamic Binding" feature of Visualforce lets you develop generic Visualforce pages to display information related to the records without necessarily knowing which data fields to show. This is accomplished through a formula-like syntax, which makes it simple to manage even a complex hierarchy of records. "Visualforce Development Cookbook" provides solutions for a variety of challenges faced by Salesforce developers and demonstrates how easy it is to build rich, interactive pages using Visualforce. Whether you are looking to make a minor addition to the standard page functionality or override it completely, this book will provide you with the required help throughout. "Visualforce Development Cookbook" starts with explaining the simple utilities and builds up to advanced techniques for data visualization and reuse of functionality. This book contains recipes that cover various topics like creating multiple records from a single page, visualizing data as charts, using JavaScript to enhance client-side functionality, building a public website and making data available to a mobile device. "Visualforce Development Cookbook" provides lots of practical examples to enhance and extend the Salesforce user interface.
Table of Contents (16 chapters)
Visualforce Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The Visualforce framework allows developers to build highly customized, personalized, and branded user interfaces for their Salesforce and Force.com applications. Hosted natively on the Force.com platform, Visualforce gives developers complete control over all areas of the user interface, allowing them to satisfy complex business requirements and support multiple devices.

Visualforce pages use a mixture of HTML and Visualforce components, which are processed server side and delivered to the browser as HTML. This allows the use of standard web technologies, such as CSS and JavaScript, to provide an enriched and dynamic user experience.

Visualforce Development Cookbook provides solutions for a variety of challenges faced by Salesforce developers, and demonstrates how easy it is to build rich, interactive pages using Visualforce. Each recipe contains clear, step-by-step instructions along with detailed explanations of the key areas of Visualforce and Apex code that deliver the solution.

Whether you are looking to make a minor addition to the standard page functionality or override it completely, this book will provide you with practical examples that can be readily adapted to a number of scenarios.

What this book covers

Chapter 1, General Utilities, covers enhancing or replacing standard functionality with Visualforce, systemizing business processes, guiding users through the creation and ongoing management of data, and writing effective tests.

Chapter 2, Custom Components, demonstrates how to create custom Visualforce components to encapsulate functionality for re-use across multiple pages, and techniques to allow communication between component and page controllers.

Chapter 3, Capturing Data Using Forms, describes how to capture data entered in a Visualforce page and send this to the server for processing.

Chapter 4, Managing Records, offers techniques to streamline and enhance the management of Salesforce data using Visualforce pages, using styling to indicate required fields, and changing pages in response to user actions.

Chapter 5, Managing Multiple Records, covers recipes to manage multiple records in a single page, from editing parent and child records through to managing a deep and wide hierarchy.

Chapter 6, Visualforce Charts, presents a series of recipes to create charts of increasing complexity, embed a chart into a standard Salesforce page, and add multiple charts to a single page in a similar style to a Salesforce dashboard.

Chapter 7, JavaScript, shows how to use JavaScript to provide a variety of client-side enhancements, including confirmation of user actions, instant feedback on user inputs, and animation of content to create tickers and carousels.

Chapter 8, Force.com Sites, provides step-by-step instructions to configure a publicly accessible website, allowing visitors to access Salesforce records and extracting boilerplate content out to re-usable templates.

Chapter 9, jQuery Mobile, demonstrates how to use Visualforce in conjunction with the jQuery Mobile framework to produce mobile pages to interact with data stored in Salesforce.

What you need for this book

In order to build the recipes in this book, you will need an Enterprise, Unlimited, or Developer (recommended) Edition of Salesforce and System Administrator access. You will also need a supported browser—the latest version of Google Chrome, Mozilla Firefox, Apple Safari 5 or 6, or Internet Explorer 9 or 10.

Who this book is for

This book is intended for intermediate Visualforce developers, who are familiar with the basics of Force.com, Visualforce, and Apex development. An understanding of the basics of HTML, CSS, and JavaScript is also useful for some of the more advanced recipes.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The list of available status field values for the converted lead is created by extracting all values from the LeadStatus database table."

A block of code is set as follows:

public void uploadImage()
{
  att.parentId = parentId;
  att.Name='image';
  insertatt;
  
  att=new Attachment();
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Navigate to the Apex Classes setup page by clicking on Your Name | Setup | Develop | Apex Classes."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.