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 › 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, 2 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;
      }
      }

    • 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

    application solution

    Popular Salesforce Blogs

    Different types of relationships in Salesforce

    Blog in Salesforce Admin

    Hello all, as the name suggests, in this blog, you will get to know about relationships between objects in Salesforce, what types of relationships are…

    Custom Objects, External Relationships, Lookup Field, Parent Account, Salesforce Connect
    Udit Feb 20, 2020
    37,432  Views

    Salesforce Features That Help Nonprofits Boost Engagement

    Blog in Salesforce

    As we’ve already discussed how important Salesforce is for startups, it’s time to explore how useful it can be outside the realm of business. With…

    AppExchange, Boost Engagement, Business, Campaigns, Communication
    Apphienz Aug 12, 2021
    3,266  Views
    salesforce marketing cloud

    All About Salesforce Marketing Cloud, Email studio and Content Builder

    Blog in Salesforce Cloud Platform

    Hey you all, hope you are doing well! In this blog, I am going to tell you about Marketing Cloud and its primary email sending…

    Automation Studio, automation tools, Content Blocks, Content Builder, CRM
    Udit Mar 24, 2020
    11,271  Views

    Popular Salesforce Videos

    Famous Brands With Their Applications Listed On Salesforce AppExchange

    Famous Brands With Their Applications Listed On Salesforce AppExchange

    Video in AppExchange, Salesforce Apps

    Selling your app on AppExchange can dramatically increase your business revenue. Various renowned brands have already harnessed the potential of this marketplace to broaden their…

    Salesforce Developer, salesforce, Salesforce Hulk, Salesforce Webinar, AppExchange
    Cyntexa Jul 19, 2023
    897  Views
    Why Should You Attend Dreamforce To You 2020

    Why Should You Attend Dreamforce To You 2020

    Video in Salesforce Stories, Events

    Dreamforce - The event which brings together the entire Salesforce community is just around the corner. Learn why there’s so much hype around this mega…

    dreamforce, Salesforce Event, Salesforce Community, Salesforce Video, Salesforce Learning
    Algoworks Nov 24, 2020
    1,266  Views
    Summer '20 Release - Release Updates Page

    Summer '20 Release - Release Updates Page

    Video in Others, Salesforce Stories

    Check out the new Release Updates Page. Salesforce Summer '20 is full of amazing features for #AwesomeAdmins! Check out what's new when you follow and…

    Salesforce Training, Salesforce Admin, Salesforce Video, Salesforce Learning, Summer 20
    Neha Yadav Jul 14, 2020
    1,320  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

    © 2025 - 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.