Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • 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
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • 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
    • Marketplace
    • Advertise With Us
    • 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 6 years, 2 months 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

    application solution

    Popular Salesforce Blogs

    Self Service Portal

    Challenges Faced by Customers in Salesforce Self Service Portal and Tips to Fix Them

    Blog in Salesforce integration

    The self-service portal is the present and the future of how businesses and customers interact with each other. The easiest and the most effective way…

    Articles, Better Experience, Browsers or Devices, Businesses and Customers, Change Password
    CRMJetty Sep 28, 2020
    4,718  Views
    What are validation rules in Salesforce?

    What are Validation Rules in Salesforce? | All You Need to Know

    Blog in Others

    The main purpose of using the Salesforce Validation rule verifies that the data a user enters in a record meets the standards you specify before…

    Create Validation Rules, Custom Validation, Data Validation Rules, Description, Detailed Object List
    saurabh Apr 12, 2023
    965  Views
    salesforce sms

    Salesforce SMS Application To Grow Your Customers

    Blog in AppExchange

    One of the basic requirements of every business is to grow its user base. And for this, they adopt several approaches. This includes marketing, advertising,…

    App, Automate Responses, Business, Business Communications, Business Expenses
    360 SMS APP Oct 12, 2022
    2,186  Views

    Popular Salesforce Videos

    5 Service Cloud Dashboards For Your Board | Webinar

    5 Service Cloud Dashboards For Your Board | Webinar

    Video in Salesforce customization

    Discover the Power of Service Cloud Dashboards! Watch AblyPro's exciting webinar video on 5 Service Cloud Dashboards For Your Board' to unlock the secrets of…

    Salesforce Service Cloud, salesforce, Learn Salesforce, Salesforce Webinar, Salesforce Video
    AblyPro Jun 21, 2024
    1,143  Views
    Creation Of An App In Salesforce | Salesforce Development Tutorial

    Creation Of An App In Salesforce | Salesforce Development Tutorial

    Video in Salesforce Training, Salesforce Apps

    Creation of an app in Salesforce. This video will cover the following points - App Creation Get to know why an app is created. Configuration…

    Salesforce Training, Salesforce Tutorial, Salesforce Implementation, salesforce, Salesforce Apps
    Algoworks Jun 24, 2021
    2,264  Views
    Why Are Some of The World’s Biggest Brands Transitioning Towards Headless? | Salesforce

    Why Are Some of The World’s Biggest Brands Transitioning Towards Headless? | Salesforce

    Video in

    With the advancement of headless architecture, consumers can now enjoy an omnichannel shopping experience. But that's not all that headless commerce has to offer. Leading…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Webinar, Salesforce Learning
    Cyntexa Aug 31, 2022
    1,331  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®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.