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

    What is Enhanced Domain Deployment?

    What is Enhanced Domain Deployment in Salesforce in 2023?

    Blog in Others

    The next edition of My Domain is enhanced domains. With enhanced domains, all URLs in your organization, including those for your Experience Cloud sites, Salesforce…

    Enhanced Domain, Enhanced Domain URL, Enhanced Domain URLs, Enhanced domains, Experience Builder
    saurabh Mar 31, 2023
    1,602  Views
    Integrate QuickBooks

    How to Integrate QuickBooks and Salesforce?

    Blog in Salesforce integration

    Introduction QuickBooks, a leading accounting software platform developed and marketed by Intuit, a financial software development company helping businesses develop and sell financial, accounting, and…

    Apex Setting, App, AppExchnage, Applications in Appexchange, automated process
    Deepika Feb 17, 2021
    4,117  Views

    Unveiling the Top Trio: A Comprehensive Comparison of Three Most Effective Ways to Integrate Multiple Salesforce Instances

    Blog in Salesforce integration

    Salesforce has long been a dominant force in the CRM landscape, setting the gold standard despite its high costs and challenging implementation process. Its ability…

    Approaches, Automatic Error Handling, Budget Constraints, Business Success, Challenges
    Angie Aug 28, 2023
    964  Views

    Popular Salesforce Videos

    Salesforce Certification Registration, Check and Verify Certification Status, Trailblazer.me Profile

    Salesforce Certification Registration, Check and Verify Certification Status, Trailblazer.me Profile

    Video in Salesforce Certifications

    All About Salesforce Certification:- Schedule your Salesforce Certification Exam Link Your Salesforce Certifications to Your Trailblazer.me Profile Check & Verify Your Salesforce Certification & Maintenance…

    Salesforce Training, Salesforce Tutorial, Salesforce Certification, Salesforce Video, salesforce certification exam
    Jogender Apr 22, 2021
    2,213  Views
    Salesforce Spring ’20 Release - Our Top 10 Features

    Salesforce Spring ’20 Release - Our Top 10 Features

    Video in Lightning

    The Salesforce Spring ’20 release is just around the corner - so it’s time to get ready for some great new features. Here's our top…

    Salesforce Lightning, Salesforce Features, Salesforce VIdeos, Salesforce Spring ’20 Release, Einstein Opportunity Scoring
    Rupal Kakkar Mar 23, 2020
    1,307  Views
    How to Add 'Add Campaign' Button to the Report Type | Salesforce Tutorial

    How to Add 'Add Campaign' Button to the Report Type | Salesforce Tutorial

    Video in Salesforce Training

    Do you want to know How to Add 'Add Campaign' Button to the Report Type in Salesforce? In this session, Distinguished Architect Iman Maghroori shows…

    Salesforce Training, Salesforce Tutorial, Salesforce Video, Salesforce Learning, Report Type
    Prafull Nov 8, 2021
    2,546  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.