WhoId Vs WhatId
WhoId |
WhatId |
WhoId represents the person type things. |
WhatId represents object type things. |
LeadId and ContactId are categorized under the whoId. |
WhatId are typically categorized as an Account ID or an Opportunity ID. |
WhoId is equivalent to a contact’s ID or a lead’s ID. The label is Name ID. |
WhatId is equivalent to the ID of a related object. The label is Related To ID. |
Standard Controller Vs Custom Controller
Standard Controller |
Custom Controller |
Standard Controller consists of similar logics and functionality which are been used for the Standard salesforce page. |
Custom Controller is a class where page logic and functionality is written in Apex language. |
Standard Controller is considered as standard and custom objects that are available in Salesforce. |
Standard Controller is not objects in Salesforce but Apex classes that are used to frame page logics and functionality. |
The standard controller is auto-generated by SF for all objects. |
Custom controllers are written by you and do what your code tells them to do. |
Note: Other than Standard and Custom controller we also have Controller Extensions through which we can extend the standard or custom controller functionality. controller extension class executes in system mode if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode.
User Mode Vs System Mode
System Mode |
User Mode |
In System Mode apex code is running by ignoring the user’s permission. |
In User Mode, the Apex Code is running by following user permissions and sharing records. |
In System Mode an apex code has access to all objects and fields and object permissions, field-level security, sharing rules won’t be applied there for the current user. |
In User Mode logged in users don’t have to create permission and so they are not able to create a record. |
All apex code runs in System Mode. |
Standard controllers and Anonymous block windows run in user mode. |
Custom Setting Vs Custom Object
Custom Setting |
Custom Object |
Custom settings are used for those resources which can either be used frequently. We can directly fetch data by using getAll() and getValues(dataSetName) methods. |
Custom Object is used to create for general purpose of resources in Salesforce. |
One can create custom setting by Setup-> Develop-> Custom Setting. |
For Creating custom Object Setup -> Objects-> New Custom Object |
Data under the custom setting get exposed into the cache. |
Data under the custom object is not exposed into the cache for which one can query to fetch data. |
We can’t define validation in custom settings. |
We can define validation in a custom object. |
We can’t define workflow rules or triggers on a Custom Setting |
We can define workflow rules or triggers on a Custom Object. |
We can’t re-arrange fields on the page layout for Custom Settings. |
We can re-arrange fields on the page layout for Custom Object. |
15 Digit ID Vs 18 Digit ID
15 Digit ID |
18 Digit ID |
15 Digit CRM ID is reference in the UI. |
18 Digit CRM ID is reference through API calls. |
15 digit CRM ID is case-sensitive. |
18 digitCRM ID is case-insensitive. |
System Log Vs Debug Log
System Log |
Debug Log |
System logs contain all the system-related information. |
Debug logs are used to recognize only about the debug statements and program executions which are related to user for which the debug is logged. |
System Logs are used to refer all the recorded logs like workflows, test class executions etc. |
Debug logs are used to display only statements under debug in Apex class code. |
Standard Picklist Vs Custom Picklist Vs Dynamic Picklist
Standard Picklist |
Custom Picklist |
Dynamic Picklist |
Standard Picklist are standard fields that already exist in the Salesforce org in standard format. |
Custom Picklist are those which has been created as a custom field on any object with their respective custom values. |
Dynamic Picklist are those picklist that makes available on visualforce page by using and components. |
For Example Lead Source and Opportunity Stage fields |
For Example Any custom picklist field |
For Example please follow below code: |
Dynamic Picklist Code Example:
Visualforce Page:
<apex:page controller="DisplayData">
<apex:form>
<apex:pageblock title="Search Here">
<b>Object : </b>
<apex:selectlist size="1" value="{!selectObject}">
<apex:selectoption itemvalue="None" itemlabel="-None-"></apex:selectoption>
<apex:selectoption itemvalue="Account" itemlabel="Account"></apex:selectoption>
<apex:selectoption itemvalue="Contact" itemlabel="Contact"></apex:selectoption>
</apex:selectlist>
<apex:commandbutton value="Display" action="{!SearchObject}"></apex:commandbutton>
</apex:pageblock>
<apex:pageblock title="Search Result">
<apex:pageblocktable value="{!resultList}" var="res">
<apex:column value="{!res['Name']}"></apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
Controller:
public class DisplayData {
Public list<sobject> resultList{get;set;}
public string selectObject{get;set;}
public DisplayData() {
resultList = new list<sobject>();
}
public void SearchObject() {
if(selectObject != 'None')
resultList = Database.query('SELECT Name FROM '+selectObject+' LIMIT 20');
}
}
Thanks For Reading !!
Happy Salesforce!!