RecordTypeInfo Class
Contains methods for accessing record type information for an sObject with associated record types.
A RecordTypeInfo object is returned from the sObject describe result using the getRecordTypeInfos method. For example:
In addition to the getRecordTypeInfos method, you can use the getRecordTypeInfosById and the getRecordTypeInfosByName methods. These methods return maps that associate RecordTypeInfo with record IDs and record labels, respectively.
The following example assumes at least one record type has been created for the Account object:
The following are methods for RecordTypeInfo. All are instance methods.
-
Returns the developer name for this record type.
-
Returns the UI label of this record type. The label can be translated into any language that Salesforce supports.
-
Returns the ID of this record type.
-
Returns
trueif this record type is active,falseotherwise. -
Returns
trueif this record type is available to the current user,falseotherwise. Use this method to display a list of available record types to the user when he or she is creating a new record. -
Returns
trueif this is the default record type for the user,falseotherwise. -
Returns
trueif this is the master record type andfalseotherwise. The master record type is the default record type that’s used when a record has no custom record type associated with it.
Returns the developer name for this record type.
public String getDeveloperName()
Type: String
Returns the UI label of this record type. The label can be translated into any language that Salesforce supports.
public String getName()
Type: String
Returns the ID of this record type.
public ID getRecordTypeId()
Type: ID
Returns true if this record type is active, false otherwise.
public Boolean isActive()
Type: Boolean
Returns true if this record type is available to the current user, false otherwise. Use this method to display a list of available record types to the user when he or she is creating a new record.
public Boolean isAvailable()
Type: Boolean
Returns true if this is the default record type for the user, false otherwise.
public Boolean isDefaultRecordTypeMapping()
Type: Boolean
Returns true if this is the master record type and false otherwise. The master record type is the default record type that’s used when a record has no custom record type associated with it.
public Boolean isMaster()
Type: Boolean