Skip to main content

Posts

Showing posts from November, 2018

How to know object name from a record Id in dynamically ?

Hi All, There are may ways to identify object name from the record id, Below is the simplest one. String recId = '001hjhtthijhkfj'; String sObjName = recID.getSobjectType().getDescribe().getName(); System.debug('Printing-sObjName -'+sObjName ); --- Account Here is my earlier post which talks about to get keyprefix of an object https://salesforceworld4u.blogspot.com/search?q=getkeyprefix&_sm_au_=iHVtjW2rtVRrrS6r Use Cases  Lets assume we need to modify few fields of two different object records (Say Account and Contact), user has to modify from the detail page, What will be our first step ?  We will create two custom detail page button (one for Account and another for Contact) . Buttons will be linked to visual force page having standard controller Account/Contact. The page will have a button "Save" , Save button function will be written in an extension class. At that time we should not create two extension class one for Account another f...