+ Start a Discussion
anurajanuraj 

Re: Record type

Hi,

I have got the id of the record type. But I dint know how to get the value(name) of the record type. Pls tell the the code to get the value of the record type.

 

Thanks 

anu

Best Answer chosen by Admin (Salesforce Developers) 
rohitsfdcrohitsfdc

if you have the recordtype id, you can get the name by SOQL query. for example

 

Select r.Name, id From RecordType r where r.id='01290000000IjbNAAS'

 

All Answers

anurajanuraj

hello pls help me

rohitsfdcrohitsfdc

if you have the recordtype id, you can get the name by SOQL query. for example

 

Select r.Name, id From RecordType r where r.id='01290000000IjbNAAS'

 

This was selected as the best answer
srikeerthisrikeerthi

Hi

You can do that in this way.

 

To get the particular Recordtype of an object use this,

Recordtype[] rec=[select id,name from recordtype where id='012900000006H4W' and sobjecttype='Account'];

 

Use this Query when you need the name of Account when you know the Recordtypeid.

Account[] Ac=[select id,name,recordtypeid from Account where Recordtypeid='012900000006H4W'];

 

Thanks

Michael3.BrownMichael3.Brown

Hi Anuraj,

 

If you're using a custom object, you might be able to try.

 

SELECT cutomobject__r.RecordType.Name FROM customobject__c WHERE customeobject__r.RecordType.id = 'xxxxxxxxxx';