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, 4 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

    Salesforce Apex to Flow

    Salesforce Apex to Flow - For Starters with a Very Simple Example

    Blog in Salesforce Apex, Salesforce Tutorial

    APEX Code Into Flow We have many times heard, implemented and worked with Flows. There are many sites and videos available which would give you…

    Apex Programming, Apex Queue, API Name, AURA, Auto Launched Flows
    Harika Madiraju Dec 5, 2022
    2,477  Views

    What is the Einstein Prediction Builder in 2024?

    Blog in Others

    Artificial intelligence today simplifies decision-making by improving forecasts, automating tasks, saving time and money, and also making life easier. Using the capabilities of artificial intelligence…

    Artificial Intelligence, Automation, Contact Management, Customization, Data Analysis
    Vimera | Andersen Feb 21, 2024
    1,010  Views
    Salesforce Lightning Web Components

    Salesforce Lightning Web Components: The new way of creating robust components for modern browsers

    Blog in Lightning

    Salesforce has been on a great journey with the Lightning modules. In 2014, Salesforce had launched the Lightning component framework that was supported by the…

    Aura Framework, Aura Programming Framework, Automobile Spare Parts Products and Services, Browser Interference, Build Lightning Components
    Softweb Aug 31, 2020
    3,172  Views

    Popular Salesforce Videos

    Which Certification Is Needed In Salesforce for Getting Job?

    Which Certification Is Needed In Salesforce for Getting Job?

    Video in Salesforce Training

    Want to get a job in the Salesforce industry? Wondering which certifications are going to help. Join this useful group for Salesforce job & career…

    Salesforce Training, Salesforce Tutorial, Salesforce Certifications, Salesforce Jobs, Salesforce Industry
    Intelogik Sep 14, 2022
    1,156  Views
    Salesforce Platform Quick Tip: How to Access Popular Items in a Single Click

    Salesforce Platform Quick Tip: How to Access Popular Items in a Single Click

    Video in Salesforce Stories

    Want to get to the things you use most with fewer clicks? Trailblazer and Senior Salesforce Developer, Ellie Matthewman shows us how to use favourites…

    Salesforce Tutorial, Salesforce Developer, salesforce, salesforce platform, Salesforce Video
    Jogender Oct 20, 2021
    2,013  Views
    What are lookup filters in Salesforce?

    What are lookup filters in Salesforce?

    Video in Salesforce Implementation

    In this video, we will leaarn about Lookup Filters in Salesforce by dividing this topic into 4 basic points, which are: 1. What is a…

    Salesforce Records, Salesforce Lightning, Salesforce Implementation, Salesforce Data Management, Salesforce Objects
    Jogender Apr 5, 2018
    3,199  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.