Skip to content

Instantly share code, notes, and snippets.

@danielfreitasce
Last active November 20, 2022 17:23
Show Gist options
  • Save danielfreitasce/fd70fded24c3518bc497dd3fe0ab81b3 to your computer and use it in GitHub Desktop.
Save danielfreitasce/fd70fded24c3518bc497dd3fe0ab81b3 to your computer and use it in GitHub Desktop.
Get the RecordType infos - Apex Salesforce
//get RecordTypeId by Developer Name
Id theRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('My_RecordType_Developer_Name').getRecordTypeId();
//get RecordTypeId by Name
Id theRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Record Type Name').getRecordTypeId();
//get RecordType Name by Id
String theRecordTypeName = Schema.SObjectType.Account.getRecordTypeInfosById().get('RecordTypeId').getname();
//where the 'RecordTypeId' is the Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment