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
Shah_DarshanShah_Darshan 

Can't fetch RecordType Name on Contract Object

Hello,

Is anyone aware, why we can not fetch RecordType.Name on 'Contract' object.

 

list<Contract> lstContract = [Select RecordType.Name From Contract where AccountId =: AccountId];

system.debug('===== lstContract: '+lstContract);

 

RecordTypeName is working good for another objects but for 'Contract' it is just giving the recordtype Id.

Please suggest.

Best Answer chosen by Admin (Salesforce Developers) 
MiddhaMiddha

Doing system.debug on an sobject does not shows the parent object values not sure when you say its working for other objects.

 

Try displaying the recordtype name and you'll see the value:

 

system.debug('\n\n: ' + lstContract[0].RecordType.Name);

All Answers

MiddhaMiddha

Doing system.debug on an sobject does not shows the parent object values not sure when you say its working for other objects.

 

Try displaying the recordtype name and you'll see the value:

 

system.debug('\n\n: ' + lstContract[0].RecordType.Name);

This was selected as the best answer
Shah_DarshanShah_Darshan


Ya ya correct.

I was doing some silly mistake.

 

Thank you very much !!