function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
renaiah anamalla 7renaiah anamalla 7 

How to retrive the recordtype records

Recordtypes 
A
B
i want retrive the records from A please code it
 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
List<Object__c> lstObj = [Select Id from Object__c where RecordTypeId='Salesforce Id of A'];
UC InnovationUC Innovation
Hi Renaiah,

Without knowing the exact naming convention in your org I cant give an exact answer but i gan give you somewhat of a template. Try doing somethins like this SOQL query
 
SELECT Id
FROM <OBJECT_API_NAME>
WHERE RecordTypeId = :A

A is the actual recordtype Id for A. To retreive the actual record type A you can do a getRecordTypeInfosByName() call to schema. More on the recordtypeinfo class can be found here (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_RecordTypeInfo.htm). Let me know if you need further assistance on this topic.

Hope this helps!

AM
ManojjenaManojjena
Hi renaiah anamalla,

Assume that you have record type in Account ,then you can get by following ways .
 
1.Scenario:
List<Account> accList=[SELECT id,Name FROM Account WHERE RecordType.Name ='A' LIMIT 50000];
2.Scenario:
//Get the record type Id For A record type
Id recId=Schema.SObjectType.Account.getRecordTypeInfosByName().get('A').getRecordTypeId();
List<Account> accList=[SELECT id,Name FROM Account WHERE RecordTypeId =: recId  LIMIT 50000];
Here you need to replace Account with your Object Name .
Let me know if it helps !!

Thanks
Manoj