Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to use Record types in a test class in Salesforce?

    Tagged: Account, Record Types, Test Class in Salesforce

    • Salesforce® Discussions

      How to use Record types in a test class in Salesforce?

      Posted by Yogesh on November 8, 2019 at 1:04 PM

      i have a requirement where i have  to use  a specific record type name while inserting a record.how can i achieve it ?

      Prachi replied 7 years ago 2 Members · 1 Reply
      • Account
      • Record Types
      • Test Class in Salesforce
    • 1 Reply
    • Prachi

      Member
      November 8, 2019 at 4:18 PM

      Hi Yogesh,

      Try this-

      Schema.SObjectType.sObjectApiName.getRecordTypeInfosByName().get('Record Type Name').getRecordTypeId();

      example

      system.debug(Schema.SObjectType.account.getRecordTypeInfosByName().get('person').getRecordTypeId())

      Thanks.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Using Marketing Cloud Genie To Deliver Customer Magic: How Salesforce Uses It To Improve your Business

    Blog in Others

    The popular Salesforce is growing its demand in the current market as the best customer relationship management application and software focusing on customer services, analytics,…

    Automate Marketing Tasks, Data Extension in Marketing Cloud, Duplicates in Marketing Cloud, Einstein in Marketing Cloud, Features of Marketing Cloud
    GetOnCRM Jan 24, 2023
    2,634  Views
    Case Management in Salesforce

    Case Management in Salesforce - Explained

    Blog in Data, Others, Salesforce

    Case in Salesforce A case is a customer's input, or issue. Back specialists can survey cases to see how they can convey a superior benefits.…

    API, Auto-response Run, Calls, Case Assignment Rule, Case Details
    Anjali Oct 12, 2020
    18,068  Views

    Implement Salesforce In Your Business

    Blog in Salesforce Implementation

    Salesforce is an amazing platform with boundless potential outcomes. As a Salesforce implementation project manager, you will own the implementation process and guide the project…

    CRM System, Lightning Component Framework, Salesforce Administration, Salesforce Consultant, Salesforce Implementation
    William May 14, 2019
    3,876  Views

    Popular Salesforce Videos

    Why Salesforce India is Primed for Growth

    Why Salesforce India is Primed for Growth

    Video in Salesforce Stories

    Amarendra Kumar, RVP of Alliances and Channels for India at Salesforce, says the region is poised for tremendous growth and opportunity over the next few…

    Salesforce Video, Salesforce Learning, Salesforce Customers, Market, Salesforce India
    Pooja Feb 10, 2021
    2,008  Views
    Salesforce Spring ‘21 Release Notes Highlights & Summer ‘21 Preparation

    Salesforce Spring ‘21 Release Notes Highlights & Summer ‘21 Preparation

    Video in Salesforce Stories

    Spring ‘21 Release Notes Highlights & Summer ‘21 Preparation In this session we discussed 00:00​ Bella Vista, Western Sydney Developer Group Overview 03:30​ Andrew Whitten…

    Salesforce Training, Salesforce Video, Salesforce Learning, Release Notes, Salesforce Release
    Rupal Kakkar May 7, 2021
    2,302  Views
    Salesforce JMS Integration Using MuleSoft | Salesforce Tutorial

    Salesforce JMS Integration Using MuleSoft | Salesforce Tutorial

    Video in Salesforce Training

    Salesforce JMS Integration. In this video, the following points will be covered - 1. Introduction Learn how to use queues to integrate data in Salesforce.…

    Salesforce Tutorial, Salesforce Video, Salesforce Learning, Mulesoft, Data
    Algoworks Jul 13, 2021
    2,504  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.