Difference between Database.query() and Database.getQueryLocator

We can retrieve up to 50,000 records.
If VF page doesn’t have read only attribute, use Database.query().
In Batch Apex, if we use Database.query(), it supports 50,000 records only.
We can retrieve up to 10,000 records.
If VF page have read only attribute, use Database.getQueryLocator().
In Batch Apex, if we use Database.getQueryLocator(), it supports upto 50 million records.

Sub Modules of CRM

A Typical CRM consists of 3 Sub Modules:

•        Marketing (Lead, Campaign, Account and Contact Management)

•        Sales (Account, Contact and Opportunity Management)

•        Services (Account, Contact, Cases and Solutions Management)


How to add Javascript to Standard Pagelayout in Salesforce?

To add Javascript to Standard Pagelayout in Salesforce, add a HTML Home page Component with HTML checkbox checked.

Sample Javascript:

<style type="text/css">
border: 2px solid black;

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

<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready( function(){

            $("#popup").css( {position: "absolute", top:event.pageY - 110, left: event.pageX});
            var temp = $(this).prev(".dataCell").find("a").attr("href");
            var depLink = temp.substring(1);           
            var qryString = "SELECT Description__c FROM Dependent__c where Id = '" + depLink + "'";
            sforce.connection.sessionId = getCookie('sid');
            var soql = qryString.toString();
            var result = sforce.connection.query(soql);   
            var records = result.getArray("records");
            for (var i = 0; i < records.length; i++)
                var taskRecord = records[i];


        function showBox()
        function hideBox()
<div id="popup">
    <div id="cls">
    <a href="#" style="color:red;">X</a><br/>
    <div id="cont"></div>


CSS is not working

If applied CSS is not working, then try to avoid blank spaces in the CSS.

Good CSS:

border: 2px solid black;

Bad CSS:


    border: 2px solid black;


Tags in Salesforce

Tags are words or short phrases that you can associate with most Salesforce records to describe and organize their data in a personalized way. Use tags to group records from various objects by a common topic or use, and then use those tags in search to make finding information fast and intuitive.

Types of tags:
    1. Personal tags are private. Only you can view any personal tags that you add to a record.
    2. Public tags are shared among all users in an organization. Any user with access to the record can view the public tags that you add.

Administrators can enable personal and public tags for accounts, activities, assets, campaigns, cases, contacts, contracts, dashboards, documents, events, leads, notes, opportunities, reports, solutions, tasks and for any custom objects.
Lightning Experience:
Vote for the following Idea:

In order to enable Tags, go to Setup --> Customize --> Tags --> Tag Settings.

For Public tags, kindly check Public Tags and for Personal Tags, kindly select Personal Tags.

 To add, tag to a record, kindly click "Add Tags" button.

Give a name to the tag and save it.

Search the tag name in the Search bar.


For all editions, a user is limited to a maximum of: 

• 500 unique personal tags
• 5,000 instances of personal tags applied to records

Across all users, your organization can have a maximum of:

• 1,000 unique public tags
• 50,000 instances of public tags applied to records
• 5,000,000 instances of personal and public tags applied to records

How to add custom button to related list in Salesforce?

1. Create a List Custom button on child object.

2. Go the parent object.

3. Edit the page layout.

4. Go to related list.

5. Click 'Settings' icon.

6. Select the button to be displayed.

7. Click 'Save'.


How to create custom tab style in Salesforce?

1. Go to Documents tab.

2. Add a image less than 20kb in size.

3. Check "Externally Available Image" checkbox without fail.

 4. Go to App setu --> Create --> Tabs and click "New" button.

 5. Click the magnifying glass icon next to Tab style and click "Create your own style" button.

6. Select Color and icon from the image stored in Documents.

This dialog only lists files in document folders that are under 20 KB and have the Externally Available checkbox selected in the document property settings. If the document used for the icon is later deleted, Salesforce replaces it with a default multicolor block icon (Default Block Icon).


Freshers Drive

"Connecting Fresh Talent with Right Opportunity"

Freshers Drive on 18th May 2013

Who are eligible-
• B.E/B.Tech/M.Tech/M.E/MCA/M.Sc (IT/CS Branches ONLY)
• 70% minimum throughout the education (Compulsory)
• Only 2012 & 2013 Batch will be considered

Interview Date: 18-05-2013
Registration Timings: 8.00 AM to 9.00 AM
Interview Timings: 9.00 AM Onwards

Interview Procedure-
• Aptitude Test (1 hr)
• Essay Writing (1/2 hr)
• Group Discussion
• Personal Interview

Documents to be carried:
• Hard Copy of the profile
• One passport size photograph

Venue Details - HighRadius Technologies Pvt. Ltd.
Ektha Pearl, 4th Floor, 1st Lane, White Fields,
BP Raju Marg, Kondapur, Hyderabad-500084.

Salesforce Interview questions with answers Part 13

1. In Data loader using upsert operation can u do update a record if that record id is already exist in page and if updated that record then can u update 2records with having same id and if not updated 2 records then wat error message is given?

It is not possible to update records with same id in a file usin upsert operation. It will throw "duplicate ids found" error.

2. One product cost is 1000. It is stored in invoice so once if change the cost of product to 800 then how can i update it automatically into a invoice?

We can achieve this using triggers or through relationship among objects.

3. One company is having some branches and all branches having different departments. So, now I want to display all departments from all branches in a single visualforce page?

Using subquery we can fetch all the required data and we can display it in VF page.

Summer ‘13 Certification Maintenance

The Summer ‘13 product releases will occur on May 17, 2013, June 7, 2013 and June 14, 2013. As a certified professional, you will be responsible for completing the Summer ‘13 release exam(s) in order to maintain your certification credential(s).

The Release Training can also be accessed here:

To learn more about what’s new in the Summer ‘13 release, review the release notes:

Deadlines to Complete Release Exams:

·         Winter ‘13 exams must be completed by Friday, June 28, 2013 (applies to individuals certified in Summer ‘12 or earlier)
·         Spring ’13 exams must be completed by Friday, November 1, 2013 (applies to individuals certified in Winter ’13 or earlier)
·         Summer ‘13 exams must be completed by Friday, February 28, 2014 (applies to individuals certified in Spring ’13 or earlier)

Salesforce Interview questions with answers Part 12

1. Can you please give some information about Implicit and Explicit Invocation of apex?
Triggers - Implicit

Javascript remoting - Explicit

2. What is apex test execution?

Exectuing apex test classes

3. What is meant by email services in salesforce?


5. How can we know few time based workflows has been fired and some more are still need to fire?


6. In an apex invocation how many methods that we can write as future annotations?


7. How can we track which time based wf's are fired and which are in the queue?


How can we track which time based workflows are fired and which are in the queue?

To track which time based workflows are fired and which are in the queue, kindly go to Setup --> Monitoring  -> Time Based Workflow.

Advantages of Salesforce CRM

  1. Flexibility
  2. Disaster Recovery
  3. Automatic Software updates
  4. Increased Collaboration
  5. Work from anywhere
  6. Document Control
  7. Security
  8. Environmentally friendly

How to find object type from Salesforce record id?

Sample Code to execute in Developer Console:

  1. Id myId = '0035A00003MuvnuQAB';  
  2. String sObjName = myId.getSObjectType().getDescribe().getName();  
  3. system.debug('Object Name is ' + sObjName);  


( Or )

Sample Code:

Visualforce page:

  1. <apex:page Controller="sample" sidebar="false" >  
  3. <apex:form >  
  5.     <apex:pageblock id="pg" >  
  7.         <apex:pageblockSection >  
  9.             <apex:pageBlockSectionItem >Record Id</apex:pageBlockSectionItem>  
  10.             <apex:pageblockSectionItem ><apex:inputtext value="{!recId}" /></apex:pageblockSectionItem>  
  12.         </apex:pageblockSection>  
  14.         <apex:pageBlockButtons >  
  16.             <apex:commandButton value="Find" action="{!find}" reRender="pg"/>  
  18.         </apex:pageBlockButtons>  
  20.         <apex:outputText >The object type is : {!objType}</apex:outputText>  
  22.     </apex:pageblock>  
  24. </apex:form>     
  26. </apex:page>  

Apex: Controller:

  1. public with sharing class sample {  
  3.     public Id recId {get;set;}  
  4.     public String output {get;set;}  
  5.     public Schema.SObjectType objType {get;set;}  
  7.     public void find() {  
  9.         objType = recId.getSobjectType();  
  10.         System.debug('Object Type is ' + objType);  
  12.     }  
  14. }  



Why Salesforce.com?

  1. Easy to use
  2. Easy to set up
  3. Click to customize
  4. No software hassles
  5. Security
  6. Ease of implementation
  7. Ease of administration
  8. Features
  9. Price
  10. Customer Support

What is Salesforce.com?

Salesforce.com is a cloud computing and social enterprise software-as-a-service (SaaS) provider based in San Francisco. It was founded in March 1999, in part by former Oracle executive Marc Benioff. Cloud computing is a general term for anything that involves delivering hosted services over the Internet. In the software-as-a-service cloud model, the vendor supplies the hardware infrastructure, the software product and interacts with the user through a front-end portal.

Salesforce.com is a web based CRM tool that helps us to maintain the relationship with the customers.

Salesforce.com is a good example for Cloud computing services.

Salesforce.com uses Multi tenant architecture.

Leaders in cloud computing systems for customer relationship management, CRM, sales, social, call centre, knowledge management software cloud computing. 


Visualforce Email Template with custom controller

Apex Controller:

public  class acctTemplt
    public Id accountId {get;set;}
    public List<Opportunity> getopptys()
        List<Opportunity> oppty;
        oppty = [SELECT Name, StageName FROM Opportunity WHERE Accountid =: accountId];
        return oppty;



<apex:component controller="acctTemplt" access="global">
    <apex:attribute name="AcctId" type="Id" description="Id of the account" assignTo="{!accountId}"/>
    <table border = "2" cellspacing = "5">
            <td>Opportunity Name</td>
            <td>Opportunity Stage</td>               
        <apex:repeat value="{!opptys}" var="o">

Visualforce Email template:

<messaging:emailTemplate subject="List of opportunity" recipientType="User" relatedToType="Account">
    <messaging:htmlEmailBody >
    Below is the list of opportunities for your account {!relatedTo.Name}.<br/><br/>
    <c:OpptyList AcctId="{!relatedTo.Id}" /><br/><br/>



Difference between created, created, and every time it’s edited and created, and any time it’s edited to subsequently meet criteria

Evaluate the rule criteria each time a record is created. If the rule criteria is met, run the rule. Ignore all updates to existing records.
With this option, the rule never runs more than once per record.

created, and every time it’s edited
Evaluate the rule criteria each time a record is created or updated. If the rule criteria is met, run the rule.
With this option, the rule repeatedly runs every time a record is edited, as long as the record meets the rule criteria.
Note: We cannot add time-dependent actions to the rule if you select this option.

created, and any time it’s edited to subsequently meet criteria
Evaluate the rule criteria each time a record is created or updated.
For a new record, run the rule if the rule criteria is met.
For an updated record, run the rule only if the record is changed from not meeting the rule criteria to meeting the rule criteria.
With this option, the rule can run multiple times per record, but it won’t run when the record edits are unrelated to the rule criteria.


If we want to trigger the workflow only when the record is created, we have to use “created”.

If we want to trigger the workflow whenever the record is created or edited even though it has currently met and triggered, we have to use “created, and every time it’s edited”.

If we want to trigger the workflow whenever the record is created or edited and previously it didn’t meet the criteria.

Simple Visualforce Email Template


<messaging:emailTemplate subject="Test" recipientType="User" relatedToType="Employee__c" >
<messaging:htmlEmailBody >
            <td>Hi {!relatedTo.Employee_Name__c},</td>
            <td>Welcome to Accord Info Matrix</td>


Link to download Apex Data Loader without login

Check in https://github.com/forcedotcom/dataloader/releases


1. Open the below URL


2. Under Data Loader : Download Current Version, click the small icon in the left side of the image to download the latest Apex Data Loader

Salesforce Interview questions with answers Part 11

1. I want to update 10 records ,can I use Trigger.new?


2. In Page layouts I want to change the Order of the layout.how can you do that?

Edit the layout.

3. Profile?what is permission set?


4. What is after update and before update?


5. Every month 1st I need to insert a record in 1 object?how will you do that?

Schedule a class. Check the below for example


6. How many types of controllers are there?

3 types.

Custom Controller.
Standard Controller.

7. I want to use more than 1 object in visual force pages?which controller will you use?


8. I want new 1 button on the detail page of standard Object ?how can you do it?

Create a button in that object and assign it to the page layout.

9. What is trigger and bulk trigger ?


10. For which events will trigger.new will support?

Insert and update.


Salesforce Interview questions with answers Part 10

1. Write a query for below.
I have 1 parent(account) and 1 child(contact),how will you get F.name,L.name from child and email from the account when Organization name in account is "CTS"?

SELECT Email, (SELECT F.Name, L.Name FROM Contacts) FROM Account WHERE Name = 'CTS'.

2. what are workflow actions?

Field Update
Email Alert
Outbound Message

3. What are outbound messages?what it will contain?

In outbound message contains end point URL.

4. What is External id?primary id?
External id is unique to external application.
Primay id is unique to internal organization.

5. Data loader?and which format it will support?

Data loader is a tool to manage bulk data. It will support .csv format of Excel.

6. How import wizard will not allow the duplicates?Using external id.

7. What are validation rules?

Used to maintain data format.

8. Recursive triggers?where you have used?


State and Country Picklists—Beta in Salesforce

State and country picklists allow users to select states and countries from predefined, standardized lists, instead of entering state and country data into text fields.

State and country picklists allow for faster and easier data entry. Reports, email templates, and list views are automatically updated and no need of Validation Rules and Triggers for data entry.

State and country picklists are available on certain standard objects.

In this beta release, you can access and use the new picklists in most places that state and country fields are available in Salesforce, including:
  •     Record edit and detail pages
  •     List views, reports, and dashboards
  •     Filters, functions, rules, and assignments
In this beta release, state and country picklists do not work with:
  •     Campaign Members
  •     Translation Workbench
  •     Salesforce to Salesforce
  •     Salesforce Touch or Salesforce Mobile
  •     Visual Workflow, packaging, or partner portals
  •     Custom indexes or outbound messages


Salesforce multitenant architecture

Multitenancy refers to a standard in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants). A software application is designed to virtually partition its data and configuration, and each client association works with a customized virtual application instance. Multitenancy is the fundamental technology that clouds use to share IT resources cost-efficiently and securely.

Tenants share IT resources securely among multiple applications and tenants (businesses, organizations, etc.).

Tenants do not share data among other Tenants.

Data to a Tenant is found using the OrgID.

To prevent malicious or unintentional monopolization of shared, multitenant system resources, Force.com has an extensive set of governors and resource limits associated with Force.com code execution. For example, Force.com closely monitors the execution of a code script and limits how much CPU time it can use, how much memory it can consume, how many queries and DML statements it can execute, how many math calculations it can perform, how many outbound Web services calls it can make, and much more.  So, a tenant cannot perform an unlimited number of database operations.

For more info, view the below site


  1. Several Out of the box features.
  2. Customization using coding.
  3. Automatic Upgrades.
  4. Simplified Release Management.
  5. Scalable.
  6. Secured.
  7. Easy to maintain.
  8. No dependency for In-House storage.
  9. Standard APIs can be utilized instead of building custom ones.
Check the following article for more information

Salesforce Interview questions with answers Part 9

1.       Ajax Components in V.F?

apex:actionPoller, apex:actionFunction, apex:actionSupport, etc.

2.       Salesforce sites?

Used to show data from our organization for public view.

3.       Rendered and Re Rendered and Re Renderdas?


4.       Auto-response rules and Escalation rules(for which objects are mandatory)?

Case and Lead.

5.       Difference between REST and SOAP API'S?

Varies on records that can be handled.

6.       What is creating debug log for users?

Track code

7.       Diff SOQL and SOSL?


8.       What is Action support and Action pollar in V.F?


9.       Diff Mater-detail & Lookup?


10.   What is Dynamic Apex?


11.   How cases are created?

Email to Case and Web to Case

12.   How many events are there in Triggers?


13.   What is after undelete?

While retrieving from recycle bin

14.   Will Trigger.new supports --->Insert,,,Will Trigger.Delete supports --->Delete


15.   What is Inline visualforce page?

Having vf page in pagelayout.

16.   Diff between Profile and permission sets?


17.   Diff between role and profile?


18.   What are sharing rules?and how many types of sharings are there?


19.   JSON?


20.   Do you know about Portals?


21.   If is child is mandatory field in lookup and I m deleting Parent,will child get deleted?


22.   Junction object?when will we use?If we delete the junction object what will happen?

For many to many relationship.

23.   Diff between controller and Extension?


24.   What is Dynamic SOQL?


25.   Context Variables in Triggers?


26.   Trigger.new and Trigger.old?


27.   Can we have V.F pages in page layout?


Context Variables in triggers

Context Variables in triggers are isExecuting, isInsert, isUpdate, isDelete, isBefore, isAfter, isUndelete, new, newMap, old, oldMap, size.

Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an executeanonymous() API call.
Returns true if this trigger was fired due to an insert operation, from the Salesforce user interface, Apex, or the API.
Returns true if this trigger was fired due to an update operation, from the Salesforce user interface, Apex, or the API.
Returns true if this trigger was fired due to a delete operation, from the Salesforce user interface, Apex, or the API.
Returns true if this trigger was fired before any record was saved.
Returns true if this trigger was fired after all records were saved.
Returns true if this trigger was fired after a record is recovered from the Recycle Bin (that is, after an undelete operation from the Salesforce user interface, Apex, or theAPI.)
Returns a list of the new versions of the sObject records.
Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.
A map of IDs to the new versions of the sObject records.
Note that this map is only available in before update, after insert, and after update triggers.
Returns a list of the old versions of the sObject records.
Note that this sObject list is only available in update and delete triggers.
A map of IDs to the old versions of the sObject records.
Note that this map is only available in update and delete triggers.
The total number of records in a trigger invocation, both old and new.


Salesforce Interview questions with answers Part 8

1. How to create standard object as child to custom object(which is not possible thru standard away process,have to bypass this restriction)?

Create Lookup and make the lookup field mandatory.
2. In a visual force page the save should ensure the data to be be stored in current object as well as associated child object?

We have to use Database.SavePoint and Database.Rollback for this situation.

3. what is audit field,what is the purpose of audit field?

Created By, Created Date, Last Modified By and Last Modified Date are audit fields. Used to track when the changes are done to the records.

4. what we need to do for extending the limit of creating only 2 M-D relationships for custom object?

Create Lookup and make the lookup field mandatory.

5. How to write java script code for save button?

We have to create custom button and in that custom button we have to write Java script code.

6. What are the attributes of apex tag?

Attribute tag is used in creating components.

7. How to insert value to a parent and child element at the same time?

Use triggers.

8. What  is the use of record types?


9. How to make pick-list as required (thru java script)?

We have to create custom button and in that custom button we have to write Java script code to check whether the picklist value is null.

10. What is the difference between Validation rule and roll-up summary fields?


11. What is the Difference between Ajax and ActionPoller?

ActionPolleris a timer that sends an AJAX update request to the server according to a time interval that you specify.

Record types in Salesforce

Record types allow you to offer different business processes, picklist values, and page layouts to different users based on their profiles. 

Record types can be used in various ways, for example:
  • Create record types for opportunities to differentiate your regular sales deals from your professional services engagements and offer different picklist values for each.
  • Create record types for cases to display different page layouts for your customer support cases versus your billing cases.
If your requirement is just for reporting, then use a Picklist Field with the name "Type". Record Type should be used only for the following purposes

1. Different Processes( Sales Process for Opportunity, Lead Process for Lead, Support Process for Case, etc).
2. Different Page layout with buttons and fields.
3. Different Picklist values for each type.

How to create One to One relationship in Salesforce?

In Salesforce, we have One to Many relationship and Many to Many relationship.

To achieve One to One relationship in Salesforce, kindly follow the below steps

Objects: Interest, Employee.
Relationship: Interest is Master and Employee is Detail.

1. Create a Roll up Summary field on Interest object to find the number of employees(Count).

2. Create a trigger in Employee object to check whether Number Of Employees is equal to one. If it is one, then throw an error, else allow the user to create.


trigger oneToOne on Employee__c (before insert, before update) {
    Set<Id> interestIds = new Set<Id>();
    Map<Id, Interest__c> mapInterest = new Map<Id, Interest__c>();
    for(Employee__c e : trigger.New) {
    List<Interest__c> listInterest = [SELECT Id, Number_of_employees__c FROM Interest__c WHERE Id =: interestIds];
    for(Interest__c intr : listInterest) {
        mapInterest.put(intr.Id, intr);
    for(Employee__c e : trigger.New) {        
        if(mapInterest.get(e.Interest__c).Number_of_employees__c == 1) {
            e.addError('Already an employee has been associated with this interest');