Friday 18 December 2015

How to learn Salesforce | Trailhead | Learn and win | Sample project in salesforce

When Ever any one asking me how learn salesforce . First thing which come in mind is TrailHead. Really Trailhead is the one of the best option to learn salesforce with lots of example and exercise.

If any one is interested to do some hand-on exercise Then below module one of best module for any new salesforce learner

Build a Battle Station App

Above module include six interesting module to learn 

1) Create the Battle Station App

This module contain information how to create a app and custom object in salesforce

2) Build the Object Model
In this  module you can learn how to create custom object and custom fields.

3) Modify the User Experience
In this module you will learn about page layout in salesforce.

4) Adding Business Logic
In this module you can learn about validation rule and process builder

5) Reports and Dashboards
Report and Dashboard is one which your will like to much. :)

6) Make the App Mobile
This module will give you idea about salesforce 1.

NOTE:- And Most import part is the if you will complete above module before 30 DEC you can win also.

There are to many module waiting for you. Please try trailhead for learning

Thanks you Salesforce for providing the Trailhead for new learner .

Wednesday 16 December 2015

How to get RecordTypeId without SOQL | Get RecordTypeId by Describe Call

Some time in code we need to get recordTypeId . For that generally we used SOQL like below :-

Id contRecordTypeId = [Select id from RecordType where sObjectType = 'Contact' and developerName ='NameOfRecordType' ].id ; 

You can try below Describe to get record Type Id without SOQL

Id contRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('NameOfRecordType').getRecordTypeId();

Amit Chaudhary

Tuesday 15 December 2015

Record ID Prefix | Object Type from Record ID Prefix | Prefix of an Object in Salesforce.

We know there are two types of record-id are present in salesforce (18 digit -- Case Insensitive,15 digit -- Case Sensitive). Only 3 digit of ids represent object type .The following is a list of the Salesforce Standard Object ID prefixes


 Please check below post for more detail

If you want to get the Prefix of any object . Please try below code.

String keyPrefix = Account.sObjectType.getDescribe().getKeyPrefix();
System.debug('PREFIX--' + keyPrefix );

If you want to get the Object Name from RecordId then please try below code.

public class SchemaGlobalDescribeToGetObjectName
    public static String findObjectNameFromRecordIdPrefix(String recordIdOrPrefix)
  String objectName = '';
            String IdPrefix = String.valueOf(recordIdOrPrefix).substring(0,3); 
            Map<String, Schema.SObjectType> gd =  Schema.getGlobalDescribe(); 
            for(Schema.SObjectType stype : gd.values())
                Schema.DescribeSObjectResult r = stype.getDescribe();
                String prefix = r.getKeyPrefix();
                if(prefix!=null && prefix.equals(IdPrefix))
                    objectName = r.getName();
                    System.debug('Object Name! ' + objectName);
        }catch(Exception e){
        return objectName;

If you want to Get the Object prefix by Workbench then please try below step :-

The easiest way to find out which key prefix maps to which object is by using a tool like the workbench . After you log into workbench, go to and pick an object from the pick list.

Step 1 :- Login in to Workbench

Step 2:- Info > Standard & Custom Objects 

Step 3:- Then select your object

Amit Chaudhary