Activity Forums Salesforce® Discussions What is the method we can use to get the Record Type Id in Salesforce?

  • madhulika shah

    Member
    August 3, 2018 at 12:35 pm

    Hello Shradha,

    If we want to avoid the query we can use:

    Id devRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Development').getRecordTypeId();

    Here, 'Development' is the record type's name. You should use anything. Also, you will have to specify your SObject type, here I have mentioned Account.

  • shariq

    Member
    September 18, 2018 at 10:48 pm

    Hi,

    There are two ways to do it -

    • Query on record type by its developer name
    • Id recId = Schema.SObjectType.Object__c.getRecordTypeInfosByName().get(‘recordTypeDeveloperName’).getRecordTypeId();

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos