December 24, 2013

How to enable quotes in Salesforce?

Hard Delete

Using Hard Delete operation, we can delete existing records from our Salesforce organization permanently. Deleted records will not be available in Recycle Bin. “Bulk API Hard Delete” check box should be enabled in user profile for permanently deleting the records.


Upsert operation in Salesforce

Upsert opeation makes use of the sObject record's primary key( Record Id) or the external ID, if specified to determine whether new records should be created or else we have to update the existing records.
  • If the key is not matched, then a new record is created.
  • If the key is matched once, then the existing record is updated.
  • If the key is matched multiple times, then an error is generated and the object record is neither inserted nor updated.

December 23, 2013

How to remove space from a string in Salesforce?

deleteWhitespace() is used to remove spaces in a string in Salesforce.

Sample Code:

String str = 'Hello Hi';
system.debug(str.deleteWhitespace()); //HelloHi

December 20, 2013


SOQL(Salesforce Object Query Language) is used to build a query to fetch data. As we write a query in SQL(Structure Query Language) with the columns and a table, here in SOQL we write the queries with the fields and an Object.

Check the below link for sample SOQLs


Detail page of Case in Salesforce

December 19, 2013

December 12, 2013

Getting Null values from Custom Settings in Test class in Salesforce

Create records for Custom Setting to avoid null values from Custom Settings in Test class in Salesforce.


public class testClass {
@TestSetup static void setupData() {
SampleCustomSettings__c obj = new SampleCustomSettings__c(Name = 'Testing');
insert obj;
static testMethod void test() {


CTS Opening

Developer (Job Number: 00009523011)

India-West Bengal-Kolkata


Key Responsibilities
 Involved in coding, testing, debugging. Responsible for delivery of assigned work, under a module lead or team lead supervision. Needs to understand technology and quality processes within Cognizant.
 Bachelor’s degree in Engineering or Science graduates with 0-4 years of experience.

Link to Apply:

Radar Chart using Visualforce and Apex in Salesforce

Sample Code:

Visualforce page:

<apex:page sidebar="false" Controller="Sample" showHeader="true" id="pg">
<apex:chart height="750" width="800" legend="true" data="{!data}">
    <apex:legend position="left"/>
    <apex:axis type="Radial" position="radial">
        <apex:chartLabel />
    <apex:radarSeries xField="memName" yField="tenthPercent" tips="true" opacity="0.4"/>
    <apex:radarSeries xField="memName" yField="twelthPercent" tips="true" opacity="0.4"/>
    <apex:radarSeries xField="memName" yField="age" tips="true" markerType="cross" strokeWidth="2" strokeColor="#f33" opacity="0.4"/>

Apex Controller:

public class Sample {   

    public List<RadarData> data {get;set;}
    public sample() {
    data = new List<RadarData>();
        List<Member__c> memList = new List<Member__c>();
        memList = [SELECT Name, Age__c, X10th__c, X12th__c FROM Member__c];
        for(Member__c mem : memList) {
            data.add(new RadarData(mem.Name, mem.X10th__c, mem.X12th__c, mem.Age__c));
    public class RadarData {
        String memName {get;set;}
        Decimal tenthPercent {get;set;}
        Decimal twelthPercent {get;set;}
        Decimal age {get;set;}
        public RadarData(String memName, Decimal tenthPercent, Decimal twelthPercent, Decimal age) {
            this.memName = memName;
            this.tenthPercent = tenthPercent;
            this.twelthPercent = twelthPercent;
            this.Age = age;


December 11, 2013

How to disable and enable button in Visualforce page in Salesforce?

Sample Code:

Visualforce page:

<apex:page sidebar="false" Controller="Sample" showHeader="true" id="pg">
    <script src="" type="text/javascript"></script> 
        var $ = jQuery.noConflict();
        function btnClick() {           
            $('input[id*=confirmBtn]').attr('class', 'btnDisabled');
        function btnComplete(){
            $('input[id*=confirmBtn]').attr('class', 'btn');
            return true;
    <apex:form id="frm">
        <apex:actionFunction name="callShow" action="{!show}"/>        
        <apex:outputText value="{!temp}"/>
        <apex:commandButton id="confirmBtn" value="Save" onclick="btnClick();" oncomplete="btnComplete();" reRender="frm"/>

Apex controller:

public class Sample {   
    public String temp {get;set;}
    public sample() {
    public pagereference show() {
        temp = 'Testing';
        return null;


Before clicking the Button:

While Button processing:

After clicking the Button:

Trigger to sum all the child record field and storing it in another object field in Salesforce

Consider the below Scenario
Quote and Structure__c --> Master Detail relationship
Quote and Bigmachine__c --> Lookup relationship
Structure__c and Bigmachine__c --> Lookup relationship

We have to calculate total scope on Big Machine object, which should be the sum of all scope in Structure__c object.

Sample Trigger:

trigger Structure_AIUD on Structure__c (after insert, after update) {
    Set<Id> quoteIds = new Set<Id>();
    List<Structure__c> structList = new List<Structure__c>();
    Map<Id, List<Structure__c>> quoteIdStructListMap = new Map<Id, List<Structure__c>>();
    List<Big_Machine__c> bigMachineList = new List<Big_Machine__c>();
    Map<Id, Double> quoteIdTotalScopeMap = new Map<Id, Double>();
    for(Structure__c struct : trigger.New) {
    structList = [SELECT Id, Scope__c, Quote__c FROM Structure__c WHERE Quote__C IN : quoteIds];
    bigMachineList = [SELECT Id, Total_Scope__c, Quote__c FROM Big_Machine__c WHERE Quote__C IN : quoteIds];
    if(bigMachineList.size() > 0) {
        if(structList.size() > 0) {
            for(Structure__c struct : structList) {
                if(!quoteIdStructListMap.containsKey(struct.Quote__c)) {
                    quoteIdStructListMap.put(struct.Quote__c, new List<Structure__c>());
            for(Id quoteId : quoteIdStructListMap.keySet()) {
                List<Structure__c> tempStructList = new List<Structure__c>();
                tempStructList = quoteIdStructListMap.get(quoteId);
                Double tempTotalScope = 0;
                for(Structure__c struct : tempStructList) {
                    tempTotalScope = tempTotalScope + struct.Scope__c;
                quoteIdTotalScopeMap.put(quoteId, tempTotalScope);
        for(Big_Machine__c bigMachine : bigMachineList) {
            bigMachine.Total_Scope__c = quoteIdTotalScopeMap.get(bigMachine.Quote__c);
        update bigMachineList;

December 10, 2013

Coding standards in Salesforce

Visualforce page Name:




Controller Name:




Extension Name:




Test Class Name:




Batch Class Name:




Scheduler Class Name:




1. Never use SOQL and DML inside for loop.

2. Never hard code values inside the apex classes. Make use of Custom Label or Custom Component.

Test Class for Standard Controller in Salesforce

Check the below code for writing test class for standard controller apex class.

Sample Code:

  1. Account a = new Account( Name = 'Test' );  
  2. Class_Name obj = new Class_Name( new ApexPages.StandardController( a ) );  

here the controller is referred to a page where the standard controller is Account.

December 9, 2013

TCS Off Campus for 2012 and 2013 passedouts

Company: TCS
Salary Offered: Best in the Industry
Job Role: Software Engineer
Qualification: B.E/B.Tech, MCA, MS, MTECH
Experience: Fresher

Register using the below link for upcoming off campus:

December 8, 2013

CreatedBy and CreatedDate in SOQL

Sample SOQL:

SELECT Id, CreatedById, CreatedDate FROM Account

December 5, 2013

QlikView free tutorial

Check the below link for QlikView free tutorial


CurrentStatus in user object in Salesforce

CurrentStatus is similar to posting your current status in Facebook. If we create a Post in Facebook, it will be available in your posts. Similarly whenever this current status is updated, a new Post will be posted in your chatter.

If you update this field, the API automatically adds a post of type UserStatus on the user’s profile in Chatter.

This field is deprecated in API version 25.0. To achieve similar behavior, post to the user directly by creating a FeedItem with the user’s ParentId.


December 4, 2013


QlikView is the most flexible Business Intelligence platform for turning data into knowledge. More than 24,000 organisations worldwide have enabled their users to easily consolidate, search, and visually analyse all their data for unprecedented business insight using QlikView’s simplicity.

 Effective decision-making is based on having the right information available and easy accessible.
Taking just minutes to learn, the automatic associations of QlikView create endless possibilities for making ad hoc queries without requiring tediously defined structures and hierarchies, as is typical in other data analysis tools. QlikView promotes unrestricted analysis of application data, helping users make time-saving and accurate decisions.

It brings a whole new level of analysis, insight, and value to existing data stores with user interfaces that are clean, simple, and straightforward.

Opening for Freshers 2011|2012|2013|2014

Name Of The Company: Capgemini
Experience Required: Freshers
Educational Qualification: Any Graduate/PG
Job Designation: Entry Level Engineer
Functional Area: Application Programming
Type of Industry: IT-Software Services
Package Offered : Best in Market
Work Location: Across India
About company: 
Capgemini is one of the world’s foremost providers of consulting, technology and outsourcing services. Present in 40 countries with more than 120,000 employees, the Capgemini Group helps its clients transform in order to improve their performance and competitive positioning.We offer an array of integrated services that combine top-of-the-range technology with deep sector expertise and a strong command of our four key businesses.

Parent relationship queries are disabled in Workbench

1. Go to the Workbench setting.

2. In Query & Search option, check "Allows SOQL Parent Relationship Queries" check box and click on apply setting.

You will be able to access the parent relationship queries. Community

Check the below link for Community


December 3, 2013 is an on‑demand (cloud-based) human capital management and financial management software vendor. It was founded by David Duffield, the founder and former CEO of the ERP giant PeopleSoft, and former PeopleSoft chief strategist Aneel Bhusri following Oracle's hostile takeover of PeopleSoft in 2005. It targets the customers of rivals Oracle or SAP by offering them "online services at a fraction of the cost of upgrading from their incumbent vendors".

Workday is the leader in SaaS-based enterprise solutions for human resources, payroll and financial management, providing new levels of business agility for a fraction of the cost of buying, deploying and maintaining legacy on-premise systems.

Workday Human Capital Management and Workday Financial Management use modern, standards-based technologies to provide an unparalleled level of agility, ease-of-use, and integration capability.

For more information about Workday, kindly visit


December 2, 2013

Test class for Schedulable class in Salesforce

Sample :

  1. @istest  
  3. public with sharing class SampleTest {  
  5.     static testmethod void testSample() {  
  7.         Test.startTest();  
  8.         Schedulable_Class obj = new Schedulable_Class();  
  9.         obj.execute( null );  
  10.         Test.stopTest();  
  12.     }  
  14. }  

December 1, 2013

Code Coverage in Salesforce Testing

1. Go to Developer Console.

2. Go to Test --> New Run.

3. Select the Test class and click "Run" button to run the test.


November 29, 2013

Test class for Batch Apex in Salesforce

When testing your batch Apex, you can test only one execution of the execute method. You can use the scope parameter of the executeBatch method to limit the number of records passed into the execute method to ensure that you aren't running into governor limits.

The executeBatch method starts an asynchronous process. This means that when you test batch Apex, you must make certain that the batch job is finished before testing against the results. Use the Test methods startTest and stopTest around the executeBatch method to ensure it finishes before continuing your test. All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously. If you don’t include the executeBatch method within the startTest and stopTest methods, the batch job executes at the end of your test method for Apex saved using API version 25.0 and later, but not in earlier versions.

Starting with Apex saved using API version 22.0, exceptions that occur during the execution of a batch Apex job that is invoked by a test method are now passed to the calling test method, and as a result, causes the test method to fail. If you want to handle exceptions in the test method, enclose the code in try and catch statements. You must place the catch block after the stopTest method. Note however that with Apex saved using API version 21.0 and earlier, such exceptions don't get passed to the test method and don't cause test methods to fail.

Sample Test Class:

public class SampleTest {
public static testMethod void testBatch() {
Batch_Class_Name obj = new Batch_Class_Name();
ID batchprocessid = Database.executeBatch(obj );


November 27, 2013

November 26, 2013

Formula Expression is required on the action attributes error

Formula Expression is required on the action attributes error occurs when pagereference('/apex/pageName') doesn't have backslash in front of apex.

Correct: pagereference('/apex/sample1');

Incorrect: pagereference('apex/sample1');

in incorrect, backslash ('/') is missing in front of apex.


November 25, 2013

apex:actionFunction is not calling Apex method - Work around

Sometimes, apex:actionFunction is not calling Apex method. The Work around for this is, the Javascript function should return true or false. In apex:commandButton, before calling the Javascript function, we should add return. If the Javascript function returns true, then the method will be invoked else it will not invoke the Apex method.


Visualforce page:

<apex:page sidebar="false" Controller="Sample" showHeader="true">
<apex:form >
    <apex:commandButton value="show" onClick="return confirmReq();" action="{!show}"/>
<apex:outputPanel id="jspanel">
    <script src="" type="text/javascript"></script>
        function confirmReq() {
        if(condition) {
            return true;    
        } else {
            return false;                                


public class Sample {     
    public sample() {
    public void show() {

in the above example, show() from Apex will not be executed until the Javascript function returns true.


November 22, 2013

How to apply auto number for existing records in Salesforce?

Check "Generate Auto Numbers for existing records" check box while creating auto number field.

It will take some time to reflect after creating the field.


How to display Parent, Child and Grandchild records in pageBlockTable in Salesforce?

Objects: Member, Interest, Equipment

Parent : Member
Member's Child : Interest
Member's Grandchild and Interest's Child : Equipment

Visualforce page:

<apex:page sidebar="false" Controller="Sample" showHeader="true">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockTable value="{!memberWrapperList}" var="W">
        <apex:column value="{!W.member.Name}"/>
        <apex:column value="{!W.member.Age__c}"/>
        <apex:column >
            <apex:pageblockTable value="{!W.intrstList}" var="I">
                <apex:column value="{!I.Name}"/>
                <apex:column >
                    <apex:pageBlockTable value="{!I.Equipments__r}" var="E">
                        <apex:column value="{!E.Name}"/>
                        <apex:column value="{!E.Serial_Number__c}"/>

Apex Controller:

public class Sample { 
    public List<Member__c> memberList { get; set; }
    public List<Interest__c> interestList { get; set; }
    public Map<Id, List<Interest__c>> memIdInterestListMap { get; set; }
    Set<Id> memberIds = new Set<Id>();
    Map<Id, Member__c> memberMap = new Map<Id, Member__c>();
    public List<MemberWrapper> memberWrapperList { get; set; }

    public Sample() {   
        memberList = [SELECT Age__c, Name FROM Member__c];
        memIdInterestListMap = new Map<Id, List<Interest__c>>();
        memberWrapperList = new List<MemberWrapper>();
        if(memberList.size() > 0) {
            for(Member__c mem : memberList) {
                memberMap.put(mem.Id, mem);
            interestList = [SELECT Name, Member__c, (SELECT Name, Serial_Number__c FROM Equipments__r) FROM Interest__c WHERE Member__c IN : memberIds];
            system.debug('Interest List is ' + interestList);
        if(interestList.size() > 0) {
            for(Interest__c intrst : interestList) {
                    memIdInterestListMap.put(intrst.Member__c, new List<Interest__c>());
            for(Id interestId : memIdInterestListMap.keySet()) {
                memberWrapperList.add(new MemberWrapper(memberMap.get(interestId), memIdInterestListMap.get(interestId)));
    public class MemberWrapper {
        public Member__c member { get; set; }
        public List<Interest__c> intrstList { get; set; }
        public MemberWrapper(Member__c member, List<Interest__c> intrstList) {
            this.member = member;
            this.intrstList = intrstList;


November 20, 2013

How to get parent's parent id using jQuery?

Sample Code:


November 19, 2013

THE HINDU - HITACHI Scholarships

If you are interested in going to Japan, make use of THE HINDU - HITACHI Scholarships.

Check the below link for more info


November 14, 2013

System.LimitException: Too many DML rows: 10001

System.LimitException: Too many DML rows: 10001 error occurs, when we try to do DML operations to more than 10000 records at a time.

If we want to do DML operations to more than 10000 records at a time, we have to call a batch class from the current class to handle it separately.


November 13, 2013

How to sort null values at last in SOQL?

Generally in SOQL, null values are sorted first. In order to sort null values at last make use of NULLS LAST keyword.



How to Sort both in Ascending and Descending order in SOQL?


SELECT Name, CMR_Number__c FROM Account ORDER By Name ASC, AccountSite DESC

Using the above SOQL, accounts will be sorted by Name in ascending order and then by AccountSite in descending order.

November 9, 2013

How to enable Console Keyboard Shortcuts in Salesforce?

1. Go to Setup --> Build --> Create --> Apps.

2. Open the Console App.

3. Click "Customize keyboard shortcuts" link.

4. Click "Edit".

5. Enable "Keyboard Shortcuts" and click "Save" button.

6. Go to the Console application and click "Show Keyboard Shortcuts".

Salesforce Console for Sales Application

In Winter '14 Release, Salesforce has introduced Console for Sales application.

Salesforce Console for Sales allows users to access Leads, Contacts, Accounts, etc.. very easily and quickly with less number of navigation.

Advantages of Salesforce Console for Sales:

1. Quickly one can get helpful and useful information from Sales intelligence.

2. One can log interaction with the records.

3. We can pin frequently viewing record on the screen for easier access instead of searching it.

4. One can switch over other records using sub tabs instead opening the record in new window or in new tab in the browser.


 Live Agent can’t be enabled in a Salesforce Console for Sales unless Service Cloud is enabled for your organization.

Setup procedure:

1. Contact to have the Salesforce Console for Sales enabled for your organization.

Use the below links to Contact support


2. Assign the Sales Console User permission set license to a user.

3. Enable the “Sales Console”permission on the permission set.

4. Assign the user to the permission set. Only users with a Sales Console User permission set license can be assigned to permission sets that include the “Sales Console” permission.

5. Create a Salesforce Console app and make it available in the user’s profile.

November 7, 2013

Incorrect Parameter type for operator '&' error in formula field in Salesforce

This error occur when you are trying to concatenate two fields values into a single formula field or just populating a value from a field in Formula Field which is not returning text.

To avoid this error, use TEXT() method.


TEXT(CreatedDate) & TEXT(Age__c)

here CreatedDate is a Date Field and Age__c is Number Field.

TEXT() method should be used even in case of Picklist Field.


Newly deployed fields missing issue in Salesforce

After deploying the fields and after adding those fields to the page layout, sometimes it will not be available to the users. This is mainly due to Field Level Security.

So, after deploying the fields, we have to deploy the profiles or else we have to set the Field Accessibility.

To check the field accessibility, kindly use the below link

How to find the initial owner of the record in Salesforce?

CreatedBy is used to find the initial owner of the record in Salesforce.

November 6, 2013

Page Layout Assignment

After defining page layouts, assign which page layouts users see. A user’s profile determines which page layout he or she sees. In addition, if your organization is using record types for a particular tab, the combination of the user’s profile and the record type determine which page layout is displayed.
You can assign page layouts from:
1. The object's customize page layout or record type page
2. The enhanced profile user interface.
3. The original profile user interface

Standard Object:

Custom Object:

Salesforce Success Community

Kindly visit the below link for Salesforce Success Community

In Salesforce Success Community, we can

1. Discuss about our issues we are facing in Salesforce project.

2. Get information about known issues in Salesforce.

3. Improve our knowledge in Salesforce.

4. Get quick solution from experts for our issues in Integration, Development, Administration, Web Services and so on.

5. Gain more knowledge in all aspects of Salesforce.

6. Help others for their issues where we can avoid the same issue when we face the same.

For Development related queries, post it in the below link

Price Waterfall

The price waterfall is a way of describing the progression of prices from published list price to the final price paid by a customer.

The Price Waterfall is at the heart of any pricing organization. It is an effective tool to identify margin leakages and creates visibility from a reference list price down to the pocket margin, including discounts, rebates, and other cost elements. On top of that, the visual representation of your cost allocations makes comparison with your peers very easy.

We have seen that quick wins usually lie in effective pricing execution. Examples of opportunities in this area include raising product/service value perception, introducing price corridors, optimizing product mix and minimizing margin leakages through effective discounting.

By analyzing the price waterfall, marketers can determine where product value is being lost. This can be especially important in businesses that allow the sales channel to reduce prices in order to secure customers. The price waterfall can help focus attention on deciding whether these discounts make sense for the business.

November 5, 2013

Difference between Salesforce and SAP

Very huge Software
Less weighted Software
Difficult for maintenance
Easy for maintenance
Limits are very less
Limits are very high
Has very complex process
Has very easy process
SAP coding is bulky and inefficient coding is easy and efficient
It is not that much user friendly
Very user friendly
Complex in usage
Ease in usage

November 4, 2013

How to send free SMS using Google SMS?

1. Log in to your Gmail Account.

2. Go to Settings.

3. Go to "Labs" tab.

4. Enable "SMS (text messaging) in Chat" app.

5. Add the Mobile Number to the contact.

6. Search the contact and click "Send SMS" option to send Free SMS.

November 3, 2013

How to change the password of BSNL wifi router?

To change the password of BSNL wifi router, kindly follow the below steps

1. Go to this link "".

2. Enter the login credentials

Username  : admin
Password   : admin

3. Go to Interface Setup --> Wireless.

4. Pre-Shared key is the WIFI Password. If you want you can change it here and save.

October 30, 2013

Validation rule for the Probability field in Opportunity


For Probability equal to 0, Probability = 0
For Probability equal to 10, Probability = 0.10
For Probability equal to 20, Probability = 0.20
For Probability equal to 30, Probability = 0.30
For Probability equal to 40, Probability = 0.40
For Probability equal to 50, Probability = 0.50
For Probability equal to 60, Probability = 0.60
For Probability equal to 70, Probability = 0.70
For Probability equal to 80, Probability = 0.80
For Probability equal to 90, Probability = 0.90
For Probability equal to 100, Probability = 1.00

Validation rule to avoid closing an Opportunity other than today in Salesforce

Validation Rule:

AND ( 
CloseDate <> TODAY(), 
OR ( 
ISCHANGED( StageName ) , 
DATEVALUE( CreatedDate ) = TODAY() 
Probability = 1.00//you can use isClosed = true also 

October 29, 2013

Schema Builder in Salesforce

Schema Builder provides a dynamic environment to add new custom objects, custom fields, and relationships to your schema. This eliminates the need to click from page to page to find the details of a master-detail relationship or to add a new custom field to an object in your schema. For example, if you’re using Schema Builder to view the details of your schema, you can add a new custom object without leaving Schema Builder. The drag-and-drop interface lets you easily add a custom object or new field, and saves the layout of your schema any time you move an object.

Schema Builder provides details such as the field values, required fields, and how objects are related by displaying lookup and master-detail relationships. You can view the details for both standard and custom objects in Schema Builder.

Schema Builder is enabled by default and lets you add the following to your schema:
  1. Custom objects
  2. Lookup relationships
  3. Master-detail relationships
  4. Fields of the following types:
  5. Auto Number
  6. Formula
  7. Roll-up Summary
  8. Checkbox
  9. Currency
  10. Date
  11. Date/Time
  12. Email
  13. Number
  14. Percent
  15. Phone
  16. Picklist
  17. Picklist (Multi-Select)
  18. Text
  19. Text (Encrypted)
  20. Text Area
  21. Long Text Area
  22. Rich Text Area
  23. URL
1. Go to Setup --> Schema Builder.

2. Drag and drop Object.

3. Save the object with details.

4. Add a field by drag and drop.

5. Save the field.


Freeze Button in Salesforce User detail Page

Freeze button prevent users from logging into your organization.

Note: Freezing user accounts doesn't frees the user licenses available for use in your organization.

User permission needed: Manage Users.