Q. How to abort all the running batch jobs at once ?
for( AsyncApexJob aJob : [Select Id From AsyncApexJob]){

Q. How can we get Record Type information using Describe call ?
//Get Id from record type name
Id recTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get(RecordTypeName).getRecordTypeId();

//Get Name from record type Id
Id recTypeName = Schema.SObjectType.Account.getRecordTypeInfosById().get(RecordTypeId).getName();

Q. How to convert Map into List ?
Map<String,String> stringMap = new Map<String,String>();

//Convert Map into List
List<String> stringList = stringMap.Values();

Q. How to process parent and child records in a single query ?
//Getting all accounts and related Contacts using relationship name "Contacts"
List<Contact> consList;
for( Account a : [Select Id, Name, (Select Id From Contacts) From Account ]){
//Adding more than one contact at a time using "addAll" method.
    consList.addAll( a.Contacts);

Q. How to access Custom Settings in apex code ?
//List type custom setting access (By Name field)
CustomSeting__c settings = CustomSeting__c.getValues(Name);
//Hierarchy type custom setting access (By ProfileId field)(
CustomSeting__c mc = CustomSettingName__c.getInstance(pid);

Q. How to execute a batch class from developer console ?
BatchContactUpdate b = new BatchContactUpdate();

Q. How to track the limits and usage for the organization using the Workbench ?
1. Ensure you are logged into the organization where you want to verify your limits.
2. Navigate to https://workbench.developerforce.com/login.php
3. Accept any oauth prompts to complete authentication
4. Select “Jump to REST Explorer”
5. Select execute
6. From the options presented select:  /services/data/vXX.0/limits

Q. How to get the base URL for the Salesforce instance you are working ?

System.debug(URL.getSalesforceBaseUrl().toExternalForm() );

Formula Field:


MID($Api.Partner_Server_URL_400, 1, FIND( ‘salesforce.com’, $Api.Partner_Server_URL_400)+13)