Using getRecordTypeInfosByName()
requires you to pass the Record Type Name. A Record Type Name is a label, which means that it can be
easily changed by an administrator. When this happens, the code will simply stop working until a developer updates the Record Type Name. Even worse,
Labels are usually translated in multi-language environments, which will again make the code fail.
The method getRecordTypeInfosByDeveloperName() also enables you to get the Record Type Id, but it requires instead a Record Type API Name, which is
rarely changed.
Thus it is safer to use getRecordTypeInfosByDeveloperName()
than getRecordTypeInfosByName()
.
Noncompliant code example
Id RTId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Asia Service').getRecordTypeId();
Compliant solution
Id RTId = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('Asia_Service').getRecordTypeId();