1

I am trying to get the api name of a record type on a object But I am only able to get Name. How can I achieve it?

Schema.SObjectType.Projects__c.getRecordTypeInfosByName().get(projects.RecordType.Name)

This also it don't contain api name it only contain the name of the record type.

2

Record Types have Names (Called Record Type Label in UI) that we see in the interface and "Developer Names" (called Record Type Name in UI) that are the equivalent of API Names because they use the sluggified with underscores although not with a trailing double-underscore plus "c".

Check out this doc that explains all the metadata available about Record Type: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_recordtype.htm

1

According to this discussion on the Salesforce Developer forums, Record Types don't have API names. If that's the case, it would explain why the RecordTypeInfo class has a getName() method but no method to retrieve an API name.

  • yes @rob, but every record type have a name other than label by using which we refer it - Record Type Name:Project_Details. But when i check in debug log the record type name in Schema.SObjectType is Project Details i.e label for record type. My logs : [getName=Project Details;getRecordTypeId=---;isAvailable=true;isDefaultRecordTypeMapping=true;]. So how can i get the name not the label. – Anu Sep 18 '15 at 13:02

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.