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 › What is the best way to check if organization has Person Account enable or not using Salesforce Apex?

    Tagged: Account Object, Boolean, isPersonAccount, Person Account, Salesforce Apex, Salesforce Organization, Salesforce sObject

    • Salesforce® Discussions

      What is the best way to check if organization has Person Account enable or not using Salesforce Apex?

      Posted by Aman on September 22, 2018 at 9:40 PM

      What is the best way to check if organization has Person Account enable or not using Salesforce Apex?

      Parul replied 7 years, 11 months ago 3 Members · 2 Replies
      • Account Object
      • Boolean
      • isPersonAccount
      • Person Account
      • Salesforce Apex
      • Salesforce Organization
      • Salesforce sObject
    • 2 Replies
    • shariq

      Member
      September 22, 2018 at 9:41 PM

      // Test to see if person accounts are enabled.
      public Boolean personAccountsEnabled()
      {
      try
      {
      // Try to use the isPersonAccount field.
      sObject testObject = new Account();
      testObject.get( 'isPersonAccount' );
      // If we got here without an exception, return true.
      return true;
      }
      catch( Exception ex )
      {
      // An exception was generated trying to access the isPersonAccount field
      // so person accounts aren't enabled; return false.
      return false;
      }
      }

    • [adinserter block='9']
    • Parul

      Member
      September 23, 2018 at 5:28 AM

      Using isPersonAccount property on an Account and catch any exception that occurs if that property is missing. If an exception is generated then person accounts are disabled. Otherwise they’re enabled. To avoid making person accounts required for the package you assign the Account object to an sObject and use sObject.get( ‘isPersonAccount’ ) rather than accessing that property directly on the Account object.

      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

    Why Should Organizations Consider Outsourcing Their Salesforce Development?

    Blog in Salesforce Consultant

    As a top-rated CRM, Salesforce can be leveraged by businesses to increase their sales and productivity. Besides helping organizations manage their business processes, the cloud-based…

    Business Process, Client Relationship, Cloud Based CRM, Cost Cutting, Cost Savings
    Girikon Apr 13, 2022
    2,504  Views
    Wrapper Classes in Salesforce | Here's What You Need to Know

    Wrapper Classes in Salesforce | Here's What You Need to Know

    Blog in Salesforce Tutorial

    Apex Wrapper Classes are custom classes in Salesforce that are used to hold one or more primitive data types as members. This allows for encapsulating…

    Apex Wrapper Classes, Browser, Class, Components, Container Class
    Pranjal Feb 10, 2023
    2,314  Views

    The Ultimate Guide to Agentforce: Everything You Need to Know

    Blog in Salesforce

    Imagine having a personal assistant who’s always available and can seamlessly handle various tasks; that’s what Agentforce is. It is like hiring a team of…

    Banking Agent, Channels, Cost Saving, CRM, Customer Experience
    LevelShift (formerly DemandBlue) Aug 1, 2025
    550  Views

    Popular Salesforce Videos

    Smart Merchandising with Salesforce Einstein AI

    Smart Merchandising with Salesforce Einstein AI

    Video in AI and ML, Salesforce Einstein

    Smart Merchandising is a holistic tool that magically combines rich insights from site-wide search, navigation, purchases, and the customer’s current session with strategic business goals.…

    Salesforce Training, Salesforce Video, Customers, Salesforce Learning, Business
    Algoworks Jun 30, 2021
    1,745  Views
    Salesforce Lightning Events Tutorial I Building Component Events (Single Component)

    Salesforce Lightning Events Tutorial I Building Component Events (Single Component)

    Video in Lightning

    This Salesforce Lightning Events Tutorial will make you learn how to register an event in Salesforce Lightning and handle that event in the source component…

    Salesforce Lightning Components, Easy Way To Learn Salesforce, How To Learn Salesforce Lightning, Best Salesforce Tutorials, Free Salesforce Tutorials
    Nauman Jan 7, 2019
    2,425  Views
    Salesforce SOAP API integration using Partner WSDL

    Salesforce SOAP API integration using Partner WSDL

    Video in Salesforce Integration

    This video is another one on our Salesforce Integration learning video series, through this video our experts will be going to demonstrate how to use…

    Salesforce Development, SOAP, Salesforce Integration, Apex SOAP API, Salesforce Apex Code
    Pooja Apr 14, 2018
    2,526  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.