Explain the MVC design pattern of Salesforce.com – Interview Question

Model view controller (MVC) design pattern is the one of the most popular design pattern in 3 tier applications. Salesforce.com is award winning tool to manage all the data of sales team of an organization. The flexibility and assurance of safe data provided by Salesforce.com results into nonparallel development capabilities to the developer. One normal questions asked in salesforce is explaining the MVC behavior of the application.

Salesforce Model view controller (MVC)

Install or Update Force.com IDE in Eclipse – Salesforce.com

First step to start with coding in Salesforce.com is to install the force.com IDE in Eclipse. I will target the new version of eclipse which is Kepler. Force.com IDE is supported in Eclipse Juno as well as Eclipse Kepler.

So, we will start with launching the Eclipse.

Eclipse Kepler
Eclipse Kepler

then goto Help ->  Software Update / Install new software…

Eclipse Software update for salesforce

Schedule export backup of your Salesforce Data – Interview Question

Salesforce allows you to obtain a copy of all your data using the data export feature.  You can generate backup files manually once every six days or schedule them to generate automatically at weekly or monthly intervals.  The backup file will come to you in the form a zip file that contains all of your organization’s data in a set of CSV (comma-separated values) files.  If you do not see the data export feature, contact salesforce.com to have the Data Export Service activated.


How to Host S-Control in Visualforce Page

In order to host your s-control in your Visual Force Pages you need to the the following steps:

  1. Create a new VF page or go to your existing VF page editor
  2. Pick your S-Control API name and have it ready.
  3. Within the Page block or where you find suitable add an apex:scontrol tab as follows:
Visual force page in Salesforce.com
<apex:scontrol controlName="Google_Map" width="-100"height="415"> </apex:scontrol>

How to create S-Control in Salesforce

To demonstrate this, lets consider an example of Google Map.

Lets create a S-Control for the Google Map.

Now let’s first create a new S-Control:

  1. Click on “Setup” which is located on the top right corner of the force.com page.
  2. Expand “Develop” item and click on “S-Controls”
  3. Hit “New Custom S-Control”
  4. Provide a Label “Google Map” and a description is you wished to
  5. The Type should be HTML since we want to create a HTML, Google API mash up
  6. Now it is time to enter the code for the S-Control
S-Control in Salesforce.com
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Maps JavaScript API Example: Advanced Directions</title>
<link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv"
<link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv"

<script src=" http://maps.google.com/?file=api&amp;v=2.x&amp;key={YOUR KEY}"

<script src="/js/functions.js" type="text/javascript"></script>

<script type="text/javascript" src="/soap/ajax/13.0/connection.js"></script>

<style type="text/css">
body {
font-family: Verdana, Arial, sans serif;
font-size: 11px;
margin: 2px;
table.directions th {

img {
color: #000000;

<script type="text/javascript">

var map;
var gdir;
var geocoder = null;
var addressMarker;
var dirFrom = '{!$Request.from}';
var dirTo = '{!$Request.to}';
var mapLocale = ""
var SControlID = '{!$Request.lid}';
var SFrameIC = '{!$Request.ic}';

function initValues()
mapLocale = "en_US";


function setInputFields(from, to)
window.document.getElementById("fromAddress").value = from;
window.document.getElementById("toAddress").value = to;

function initialize()

if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "load", onGDirectionsLoad);
GEvent.addListener(gdir, "error", handleErrors);

setDirections(dirFrom, dirTo, mapLocale);

function setDirections(fromAddress, toAddress, locale) {
if ((fromAddress) && (toAddress))
gdir.load("from: " + fromAddress + " to: " + toAddress,
{ "locale": locale });

function handleErrors()
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.nError code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.n Error code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.n Error code: " + gdir.getStatus().code);

// else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS) <--- Doc bug... this is either not defined, or Doc is wrong
// alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.n Error code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given. n Error code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.n Error code: " + gdir.getStatus().code);

else alert("An unknown error occurred.");


function onGDirectionsLoad(){
// Use this function to access information about the latest load()
// results.

// e.g.
// document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
// and yada yada yada...

<body onload="initialize()" onunload="GUnload()">
<div style="background-color: #CCCCCC">
<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false">
<th align="right">
<input type="text" size="25" id="fromAddress" name="from" value="" /></td>
<th align="right">
<td align="right">
<input type="text" size="25" id="toAddress" name="to" value="" /></td>
<th align="right">
<th align="right">
<select id="locale" name="locale">
<option value="en" selected="selected">English</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="ja">Japanese</option>
<option value="es">Spanish</option>
<input name="submit" type="submit" value="Get Directions!" /></td>
<div style="border-width: 1px; border-color: #000000; border-style: solid;">
<div style="overflow: auto; width: 99.5%; height: 380px">
<table class="directions" style="width: 100%; height: 100%">
<td valign="top" style="width: 275px;">
<div id="directions" style="width: 275px; background-color: #ffffff;">
<td valign="top">
<div id="map_canvas" style="width: 100%; height: 375px; background-color: #ffffff;">

Difference between Sandbox and developer edition in Salesforce

A test environment for salesforce.com is crucial to change control. Salesforce.com provides the tools needed to test anything in a test environment before you implement it in your live instance. You can either test in a Sandbox environment or in a Developer environment. What is the difference? I will share what I know…


The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. You can copy your live instance to a sandbox environment (but you have to perform manually from sandbox to developer edition) where you can test any changes, implementations, AppExchange apps or updates. It can also be your hands-on training environment without risking your live data.

You can either copy your configuration and data into a sandbox environment or just the configuration. It acts exactly like your live instance, but be careful if you have workflow rules or automations because they will work in the sandbox as well.

I know that this sounds wonderful and if you don’t have it, you are dying to know how to get it. The problem is the cost. If you are on Unlimited Edition, then cost is not a problem because it comes included. But for Enterprise, Professional or Group Editions, you have to pay… and the price is hefty; anywhere between 25k-50k per year. For a lot of companies, that is more than they are paying for their live salesforce.com instance. So how do you test salesforce.com without Sandbox?  It is always suggested to develop application in sandbox instance then go for LIVE.

Developer Edition

Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange. It is also a great tool for testing/training in salesforce.com. What makes this a great tool is the fact that it is free. Anyone can get a Developer Edition of salesforce.com. It is a standard Enterprise Edition with very limited storage space. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel. Once it is customized, you can use it for training, testing or anything else you want. It takes a little bit of work, but you can make it act and feel just like your live instance. The work is well worth it for the free price.

To get a copy of Developer Edition for yourself or your company go here. Play around with it. Get apps from the AppExchange. Do anything and everything that you have been scared to do your live system. If you come up with a clever way of using the system, post it on AppExchange and share your knowledge.

Salesforce Interview Questions – Part 1

1. What is Apex Ans: It is the in-house technology of salesforce.com which is similar to Java programming with object oriented concepts and to write our own custom logic.

2. What is S-Control ?
Ans: S-Controls are the predominant salesforce.com widgets which are completely based on Javascript. These are hosted by salesforce but executed at client side. S-Controls are superseded by Visualforce now.

3. What is a Visualforce Page ?
Ans: Visualforce is the new markup language from salesforce, by using which, We can render the standard styles of salesforce. We can still use HTML here in Visualforce. Each visualforce tag always begins with “apex” namespace. All the design part can be acomplished by using Visualforce Markup Language and the business logic can be written in custom controllers associated with the Page.

4. Will Visual force still supports the merge fields usage like S-control ?
Ans: Yes. Just like S-Controls, Visualforce Pages support embedded merge fields, like the {!$User.FirstName} used in the example.

5. Where to write Visualforce code ?
Ans: You can write the code basically in 3 ways.

  1. setup->App Setup->Develop->Pages and create new Visulaforce page.
  2. Setup -> My Personal Information -> Personal Information -> Edit check the checkbox development mode. When you run the page like this, https://ap1.salesforce.com/apex/MyTestPage. you will find the Page editor at the bottom of the page. You can write you page as well as the controller class associated with it, there it self.
  3. Using EclipseIDE you can create the Visulaforce page and write the code.

6.What are Apex Governor Limits?

Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception.

7. How to create and host S Control in Salesforce ?



8. Difference between Sandbox and Development environment?


9. How to schedule export or take the backup of salesforce?