Wednesday, November 13, 2013

Book Review - Visualforce Development Cookbook

I have started to work on platform on April, 2011. At the beginning, I haven’t any knowledge about technologies. I have identified the discussion board as a home for a newbie since there are lots of experts to answer our technical issues. I found “Bob Buzzard” (Keir Bowden) in the discussion board and he was playing with the technical issues. He helped me a lot of my technical issues. He is an answering machine. He has a tremendous blog. I followed his way and I have used his achievements as a reference.

It is with great privilege that I write this review of Visualforce Development Cookbook which authored by Keir Bowden. It is aimed at developers who have some experience on Visualforce and packs over 75 recipes in the 300+ pages.

This book covers all the techniques that we use in day to day developments in Visualforce. Sometimes we struggle to come up with a particular solution. Sometime we will waste considerable time to sort out the particular issue. This book has solutions with step-by-step instructions for such technical issues. For an example, we have already developed Visualforce pages with JavaScripts and jQuery. But we are getting issues when developing them. This book has the recipes for Visualforce developments with JavaScripts and jQuery. It will help us as guidance to Visualforce developers with JavaScripts and jQuery.

My favorite chapters are Visualforce chart, Javascript, sites and jQuery mobile. There were lots of things to learn.

Still, there are few books on Visualforce and this book covers almost all the cookbook recipes. I would recommend this book for those who have some experience on Visualforce developments.

Disclaimer - I haven't purchased this book - I was sent a copy to review by the publisher.

Monday, October 7, 2013

My First Book on Visualforce - Visualforce Developer's Guide

Visualforce allows you to build sophisticated, custom user interfaces that can be hosted natively on the platform. Visualforce achieves this with the help of a tag-based language which is similar to HTML. This book aims to introduce you to Visualforce development tools to develop a better perspective towards UI development with Visualforce, and take your expertise in UI development to the next level.

"Visualforce Developer's Guide" is a hands-on guide aimed towards developing a custom UI interface. As you read through the content, you will notice that this book focuses on a single real-world example. This book builds upon this example to help you understand and use Visualforce development tools in your custom UI interfaces.

"Visualforce Developers Guide" begins with an introduction to Visualforce to give you an understanding of the MVC model and the Visualforce architecture. Special emphasis is given to building a rich user interface by leveraging JavaScript, jQuery, CSS, and HTML with Visualforce. Through the course of the book, you will learn how to reuse the code with the help of custom components, and minimize the Visualforce and Apex code through Visualforce dynamic binding. The later sections of the book focus on building Visualforce pages for mobile devices. By the end of the book, you will learn the best practices and security tips for Apex and Visualforce development.

What you will learn from this book

  • Understand the MVC model and architecture of Visualforce
  • Learn standard controllers and Standard List Controllers
  • Get to grips with dynamic references to global variables
  • Build custom charts with Visualforce charting
  • Develop Visualforce pages for mobile devices
Approach : This is a mini tutorial guide that discusses the most important and the most frequently used technical aspects of Visualforce development, thereby making it a perfect companion for Visualforce developers.
Who this book is for: This book is for Visualforce developers who are looking for a pocket guide that will resolve their most frequently faced issues.

About the Author

Chamil Madusanka is a certified Developer. He has been working on projects since 2011. He is working as a developer for many custom applications built on and has also trained end-users and new Salesforce developers in his current company (attune Lanka (pvt) Ltd) and former company (Sabre Technologies (pvt) Ltd). He has won the Salesforce New Year Resolution 2013 challenge which was rolled out by Salesforce.

Chamil is an active member of the community and he has been contributing to the community through various channels. He is avid about and shares his knowledge on technologies through his blog (  And He is a super contributor on discussion board and shares his knowledge and experience on by providing effective solutions to developer questions. And he is the initiator and the group leader of Sri Lanka Salesforce Platform Developer User Group. His contribution to Sri Lanka Salesforce community has led to increase the Salesforce competency in Sri Lanka. 

Chamil completed his Bachelor of Science in Computer Science from University of Colombo School of Computing, Sri Lanka (UCSC). His interesting areas are Cloud computing, Semantic web technologies, and Ontology based systems.

Hailing from Polonnaruwa which is an ancient city of Sri Lanka, he currently resides in Gampaha which is located in western province, Sri Lanka. His interests include reading technology books, technology blog posts and playing cricket. Chamil can be reached via twitter (@chamilmadusanka), skype (chamilmadusanka) and email (

You can follow the book on the Facebook page for any news or offers.

Saturday, December 8, 2012

Sri Lanka Salesforce Platform Developer User Group First Meetup - My Experience

Recently Salesforce initiated Salesforce developer user groups in Sri Lanka. The goal of the user group is to build an enthusiastic, self-sustaining Sri Lankan community that enables members to be more successful with Salesforce and helps to connect with other developers of Sri Lanka Salesforce community. Developer User Group Meetups are a great opportunity to share the knowledge with community members, meet industry leaders, exchange views and ideas, socialize with peers, and network with others.


Journey begins after I completed one year with Salesforce Platform. I started to work on technologies since April 2011. I have notice that there are Salesforce Platform Developer User groups from various regions. But there were not a group in Sri Lanka. I have searched for importance to having a Salesforce Developer User Group in Sri Lanka.

Even has founded in 1999, cloud platform is new technology for Sri Lanka. There are few companies doing Developments. Therefore, if we need to success with Salesforce platform, we need to grow the Salesforce community in Sri Lanka. We need to build the connection among Sri Lankan Salesforce developers. Software development Companies need to believe technologies. Software developers need to believe this leading cloud computing platform. All the Salesforce developers in Sri Lanka need to connect with each other and share the knowledge to the Sri Lankan community. There were only one thing to do for achieve all above things. That is initiating a Salesforce Platform Developer User Group in Sri Lanka.

First, I initiated a LinkedIn group for Sri Lankan Salesforce Professionals in April 2012. Initially, few developers have joined with Sri Lankan Salesforce Professionals Group. While I’m trying to promote the group and increase the number of members using the social networking channels, I got contact with Nick Tran who is the Senior Director, Developer Marketing at He has directed me to the process of adding Sri Lankan Salesforce Professionals group to official Developer User Group List. Nick has introduced me to Kavindra Patel who is the Developer Programs Director at He called me and asked about current situation of Sri Lankan Salesforce Professionals Group. He was exciting about Sri Lankan group and he asked me to hold the first meetup. As the Developer relation manager of Asia pacific region at that time Kavindra has leaded to identify local developer community leaders from Sri Lanka, Bangalore, New Delhi, Jaipur, Hyderabad, Pune, Mumbai, Kochi, and Chennai. With cloud computing being top of mind for developers in the Indian subcontinent , they were seeing large groups of developers jumping on board to learn about building next generation apps on the Salesforce Platform. Then has launched these Nine India Sub-Continent Salesforce Platform Developer User Groups and named community leaders from above groups. After that I had a chance to contact with April Kyle who is the Developer Program Manager at

Support from

Kavindra and April have helped me to successfully organize the first meetup of Sri Lanka Salesforce Platform Developer User Group. They have clear idea about developer use groups and how to increase the salesforce community in various countries and regions. They have proved that by number of developer user groups which has vastly increased in last two three months. Here is the complete list of current Salesforce developer user groups. You can join the group which is near to your place. April has setup a meetup account for Sri Lanka Salesforce Platform Developer User Group. Meetup account is easy to handle meetup activities.  Thanks to Kavindra and April, we got awesome goodies (T-shirts, caps, Books, etc.) for cloud Trivia.

The Event Day

With the hand of & Sabre Salesforce Team which is my current company, the first Salesforce Developer User group meetup has organized to help on 20th November, 2012 at Savsiripaya, Wijerama Mawatha, Colombo 07, Sri Lanka. That day is a historical date of Sri Lankan Salesforce community. Luckily, I’m the leader of this group and happy to be a part of this historical event. There was a great participation. There were 53 attendees. I was expected 50 or below number of participants. But I’m happy to say that there was a fully crowded meetup room. There were experienced as well as newbies for Salesforce. There were participants from CRM consulting partner companies as well as development companies. There were few undergraduates and cloud computing being top of their mind. As a result of chat with undergraduates, I’m hoping to initiate a Salesforce Student Group in Sri Lanka as a sub group of Sri Lanka Salesforce Platform Developer User Group. I have already discussed with April about Salesforce Student Group and it will be come into live soon.  We had three sessions. First one was Welcome & Introduction to Community by me. Second one was Introduction to Sites by Thushara. Third one was Hybrid mobile app development by Tuan. I would like to thanks my speakers in inaugural meetup Thushara & Tuan. Their speeches were helped for success this event and their contribution is appreciable. We had spent awesome time and valuable sessions and good feedback from the attendees. 

See more photos of Inaugural Meetup of Sri Lanka Salesforce Platform Developer User Group in Facebook page and Meetup account.


As I said before Salesforce Student group will be established in near future and it will spread out to universities in Sri Lanka. One of my goals of the Student group is every IT undergraduate will know about like he/she knows about Java/.Net now. Sri Lanka Salesforce Community is growing. With this growing, number of companies who are doing Salesforce developments will be increased. Join with u to grow the Sri Lankan Salesforce community. We will have more great meetups in future.

Sunday, October 28, 2012

Who wants to be a Certified Developer?

I gained the Salesforce developer certification on 24th October 2012. Now, I'm a Certified Developer. This post gives an overview of the exam and a few tips to hopefully assist others. I will not post any actual exam questions and answers. That will be cause to violate the test taker agreement that we all sign up to at the beginning of the exam and devalues the certification.

The Certified Developer exam measures a candidate’s knowledge and skills related to the objectives . A candidate should have hands-on experience developing custom applications on the platform. I post guidelines which gain from my experience of preparing DEV 401 exam. The starting point for the exam is the Study guide. First you need to have a understand about the format of the exam. Refer the following for exam format and how will you be tested. For more details, Refer the Certified Developer Study Guide
  1. Application Design - 5%
    • Components of application
    • Model-view-controller design paradigm
  2. Overview of Platform - 5%
    • Declarative capabilities of the platform
    • Building blocks of an application provided by the platform
  3. Data Model - 32%
    • Functional data model for a business application
    • Object relationship types
    • Permission and data access in a custom app (e.g., profiles, defaults, roles)
    • Optional (Salesforce-enabled) features for managing the application (e.g., create audit fields, encrypted fields, multi-currency)
  4. User Interface - 15%
    • Components of any application user interface (e.g., tabs, applications, detail pages, list views)
    • Declarative framework for building a user interface (e.g., what can and can’t be done in a page layout)
    • Capabilities and functionality of sites
  5. Business Logic - 23%
    • Formulas, validation rules, and workflow rules
    • Given a scenario, determine which feature to use to solve a business requirement and/or describe how to apply the solution
    • Capabilities of the approval processes
    • Given a scenario, select the appropriate features of approval processes to satisfy business requirements
    • Extending business logic through code
  6. Data Management - 10%
    • Capabilities and constraints of import wizards
    • Capabilities and constraints of API-based tools for managing data
    • Functions of the Data Loader
    • Functions of external IDs and upsert
    • Characteristics of record IDs
  7. Reporting and Analytics - 10%
    • Capabilities and constraints of reports and analytics of the platform
    • Given a scenario, determine methods for analyzing and displaying data
Recommended readings are,
  1. DEV 401 : Building Applications with and Visualforce - Student guide (which are provided at Salesforce DEV 401 training course. If You have participated to DEV 401 training, you must have this guide)
  2. Fundamentals book
  3. Developer Certification Handbook by Siddhesh Kabe
The third recommended reading has a sample paper which will be provided better understand about the actual DEV 401 exam. I'm recommending to do the sample paper of Developer Certification Handbook.

I'm listing few topics to be focused more.
  1. Security and Sharing (Very important)
  2. Object relationships
    • Lookup
      • How many lookup relationships are allowed in an object?
    • Master - Detail
      • How many master detail relationships are allowed in an object?
      • Master detail between standard and custom object.How it is implemented?
    • Many to Many using Junction object(Very Important)
  3. Workflows and Approvals
    • Standard workflows as well as time dependent
    • Approval Processes
    • Parallel Approval processes
    • Dynamic Routing Approvel
  4. Reports, Analytic Snapshots, Dashboard components
  5. Encrypted fields (Very Important)
  6. Formula fields and validation rules
    • Scenario to use formula fields and validation rules
  7. When to use system logs, when to use debug logs?
  8. Import wizards Vs data loader
  9. Page Layouts and custom tabs
    • What all can be done using page layout and what is not possible.
  10. Governor Limits

If you need further references use below links;
NOTE : This blog post covers only DEV 401 and new topics can be added with new releases. The best solution for that issue is referring latest Certified Developer - Study Guide.

Good luck for the DEV 401 Exam!!!

Friday, September 28, 2012

Prepare your sandboxes, Winter 13' is coming!! | Winter 13' Best Features | Part 1

All the users of & are always access the latest version because has comprehensive real time upgrade mechanism. It doesn't break our customizations and integrations. This real time upgrade mechanism allow us to feel the rapid and latest innovation.

After the summer, It's time to welcome Winter 13' release. Winter '13 Release Note has been released. Winter 13' has lots of interesting and innovative new features. I'm listing some of main features here.

  • Visualforce Charting - Generally available
Visualforce Charting had release as a pilot feature in Winter 12’ release. Before, we had to use Google charts or Jquery or any other third party javascript libraries for create charts in a visualforce page. Now we don’t have to depend on them. has provided Visualforce charting as collection of components that provide a simple and intuitive way to crate charts in our visualforce pages and custom components. This is an easy way to create business charts using data sets which directly queried via SOQL or by building the data set in your own Apex code. Charts are defined using Visualforce components, which generate JavaScript that renders the chart within the browser. The visualforce chart types which released in pilot version (bar, line, and pie) are joined by new four chart types : area, gauge, radar, and scatter.

Area - <apex:areaSeries>
Gauge - <apex:gaugeSeries>
Radar - <apex:radarSeries>
Scatter - <apex:scatterSeries>
  • Global Permission Sets
Permission sets have been released for generally available in Winter 12’. A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but permission sets extend users' functional access without changing their profiles.

Previously, a permission set was associated with specific user license. If you want to assign one permission set to users with different user license, you have to create several permission sets for each type of user license.  After Winter 13’ we will not suffer from that issue because Winter 13’ is going to release global permission sets which aren’t associates with a specific user license.
  • Canvas Framework—Pilot already has integration feature between apps and existing external system. But there can be have redesigning and reintegrating your external applications. What if, you have a set of tools to integrate your external application in Salesforce without redesigning and reintegrating? Here it is. Canvas Framework enables you to easily integrate a third-party application in Salesforce. Canvas Framework is a set of tools and JavaScript APIs that you can use to expose an application as a canvas app. This is a one of best feature because you can take your new or existing applications and make them available to your users as part of their Salesforce experience. The third-party app that you want to expose as a canvas app can be written in any language. The only requirement is that the app has a secure URL (HTTPS).

Canvas Framework includes tools that handle:
  1. Authentication—If your application requires authorization, you can implement it by using a signed request or OAuth 2.0.
  2. Cross-Domain XHR—JavaScript support for cross-domain XML HTTP requests back to the Salesforce domain.
  3. Context—API support that enables you to retrieve context information about the environment in which the canvas app is running.
The Canvas Framework feature is currently available through a pilot program. For information on enabling it for your organization, contact

Friday, March 9, 2012

Unit Testing in Salesforce

Testing is a key and critical component to successful long term software development process. strongly recommends using a test-driven development process which occurs at the same time as code development. Salesforce has very strong set of documentation. When I was learning salesforce unit testing, I realize that it is difficult to understand where to start read. Therefore, I summarized the unit testing for salesforce beginners to understand the basic aspects of unit testing.

There are few things to consider before you deploy or upload the code or package;
  • 75% of your Apex code must be covered by unit tests
  • All the tests must complete successfully
  • Every trigger has some test coverage (1%)
  • All classes and triggers must compile successfully
When you are writing a test class, you have to write test for Single Action, Bulk Action, Positive Behavior, Negative Behavior, and Restricted User.
  • Single Action :Test to verify that a single record produces the correct, expected result.
  • Bulk Action :  Test not only the single record case, but the bulk cases as well
  • Positive Behavior :  Verify that the expected behavior occurs through every expected permutation
  • Negative Behavior :  Verify that the error messages are correctly produced 
  • Restricted User :Test whether a user with restricted access to the sObjects used in     your code sees the expected behavior 
Test Class can be defined @isTest annotation. Before the Winter 12’ release we had only private test classes, but on Winter 12’ release salesforce has given the chance to write public test classes as well. Salesforce has released the public test classes for expose common methods for data creation. It can be used to setting up data that the tests need to run against. Public test methods can be called from a running test but not from a non-test request.

When you create a test method,
  • Use static
  • Use testMethod keyword 
  • Use void return type
  • No any arguments
  • No data changes performed in a test method
  • Don’t send emails
  • Cannot be used to test Web service callout because web services are asynchronous and tests are synchronous.
    • The API for asynchronous test runs is a Beta release (Winter ‘12)
    • For More : Apex code Developer’s Guide Page 153 
The key methods to use in your unit tests are the system.assert() methods. There are three types of system.assert() methods.
  • System.assert(condition)
  • System.assertEquals(x,y)
  • System.assertNotEquals(x,y)
For the security review, every test method must have at least one system.assert() method. We need use assert methods not only for the pass the security review but also as a best practice. It will be help us to keep track the failures of Apex classes or triggers.

Structure of the Test Class

private classTest_class
    public static testMethodvoid test_name()
Structure of public Test class for test data creation 
public class TestUtil
    public static void createTestAccounts() 
      // Create some test accounts

    public static void createTestContacts()
      // Create some test contacts

Wednesday, August 24, 2011

Displaying pop-up summaries on hover in visualforce

What if I want to make a summary pop-up window when a user hovers over a link in a visualforce page. This Feature is easy in standard salesforce pages, mostly because it happens automatically. But not in visualforce pages. I have seen most of example for pop-up in salesforce were created using the output panels with some embedded styles. 
Here I'm posting a pop-up example which show the details of a partuclar record on a mouseover using the Hover links similar to those used in standard Salesforce links. 
/*visualforce page*/
<apex:page controller="PopupTest">
<apex:form >
    <apex:repeat value="{!accounts}" var="acc">                            
          <br/>  <a href="/{!acc.Id}" id="{!acc.Id}" onblur="LookupHoverDetail.getHover('{!acc.Id}').hide();" onfocus="LookupHoverDetail.getHover('{!acc.Id}', '/{!acc.Id}/m?retURL=%2F{!acc.Id}&isAjaxRequest=1').show();" onmouseout="LookupHoverDetail.getHover('{!acc.Id}').hide();" onmouseover="LookupHoverDetail.getHover('{!acc.Id}', '/{!acc.Id}/m?retURL=%2F{!acc.Id}&isAjaxRequest=1').show();">{!acc.Name}</a>

public with sharing class PopupTest {  
    public List getAccounts()
        List accounttList = new List();
        accounttList = [Select Id, Name from Account LIMIT 10];
        return accounttList ;


Declaration: Directly depending on standard javascript libraries, query params, dom ID values or services (excluding the web services API, of course) is at your own risk. None of which are considered to be supported "APIs" and can change with any major or minor (patch) release without notice. Therefore promote this idea on ideaExchange in salesforce.