• Federico Sosa
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,
My question is: why do we need to use the Schema to get some information instead using a Dml to get the same information?
An example:

contactRTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByName().get(CONTACT_RECORDTYPE_NAME).RecordTypeId;

OR

contactRTypeId = [SELECT Id FROM RecordType WHERE Name = :CONTACT_RECORDTYPE_NAME].Id;

Thanks in advance,
Federico.