Monday, November 19, 2018

How to get Salesforce Object key prefix

if we look at the Salesforce record Id, we can observe
001G000001umxxX
001 ----------->  Object ID Prefix
G0 ------------>  Server-Id
00001umxxX -------->  Identifier

If you want to get any Salesforce object key prefix use below code
String strObjPrefix = Account.sObjecttype.getDescribe().getKeyPrefix();
System.debug('OBJ prefix ====> '+strObjPrefix);
Let us know if you any queries
Happy Learning!!!

Saturday, November 17, 2018

SOQL(Salesforce Object Query Language) is not SQL

Salesforce SOQL is not working same as SQL, Why?
  1. Salesforce using Multitenant Architecture – Many organization using single instance including database but each org will have their own virtual hardware.
  2. Salesforce using Force.com platform – It is metadata-driven architecture.
  3. SOQL directly integrated with Apex no need to establish the connection to the database.
Force.com platform having the governor limits to allow the access Multitenant Architecture
Differences between SOQL and SQL
SOQL
  • It supports only SELECT statements.
  • we can not include all columns at a time(Does not support SELECT * (must specify fields to include).
  • It supports only “relationship queries,” which are written using parent-child syntax 
  • It supports the dot notation syntax to traverse table relationships.
  • It is governed by LIMITS(e.g., returned rows, heap, etc.)
SQL
  • It Supports statements for DML, transaction control, and SELECT statements.
  • It Support SELECT * (include all columns) 
  • It Support joins, which are written using “left,” “right,” "inner," "outer" syntax.
  • It does not support dot notation syntax to traverse table relationships.
  • No governer Limits.
Let us know if you have any queries.
Happy Learning!!!