+ Start a Discussion
EldonEldon 

Difference between using RecordTypeInfo and soql query from RecordType to get all recordtypes for an object(for eg case)

Hi,

Like i posted above wht is the difference between using Schema.RecordTypeInfo returned by Case.sObjectType.getDescribe().getRecordTypeInfos() and using 
 SOQL to query Case records in the org to get all the RecordType values available for Case 

I stumbled upon this question while going through a question to display all the available record types for a case Object. 

Regards
sridharbsridharb
Hi 

Very Good Question and valid. Yeah there is diffence in both the approaches. Using Case.sObjectType.getDescribe().getRecordTypeInfos()  will not be counted to your transaction SOQL limits. Where as SOQL as you know.

Regards
Sri
 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Both will return similar information but the first one will save you a query.
EldonEldon
So this is the question wha is the right answer then,

A developer wants to display all of the available record types for a Case object. The developer also wants to display the picklist values for the Case.Status field. The Case object and the Case.Status field are on a custom Visualforce page.
Which action can the developer perform to get the record types and picklist values in the controller? (Choose 2)


A. Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues().
B. Use Schema.RecordTypeInfo returned by Case.sObjectType.getDescribe().getRecordTypeInfos().
C. Use SOQL to query Case records in the org to get all the RecordType values available for Case.
D. Use SOQL to query case records in the org to get all values for the Status picklist field.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
A,B