1

I am trying to access the Recordtype field on the Call object but when I run that field through a query (in this case the getPicklistValueLabels method) I receive the following error:

getPicklistValueLabels called with field that cannot be accessed: RecordType

Does anyone know why this might be happening? We are able to access other Salesforce Standard fields.

2

You should use either SObjectType.getDescribe().getRecordTypeInfos() (see DescribeSObjectResult) or query the RecordType object.

for(RecordTypeInfo info: Call.SObjectType.getDescribe().getRecordTypeInfos()) {
  options.add(new SelectOption(info.getRecordTypeId(), info.getName());
}
0

Record Type is different than other fields it's not really a picklist so your method would not work.

In all my happenings every time I needed to get information about the record type I had to query for it.

Example:

List<RecordType> recordTypeAcc = [SELECT Id FROM RecordType WHERE SobjectType = 'Account' AND DeveloperName = 'Dan_Account'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.