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

    Dreamforce 2024: Attendees, Here’s What’s Coming

    Blog in Salesforce

    Dreamforce has always been the crown jewel of tech events, a confluence of innovation, thought leadership, and unparalleled networking opportunities. The excitement surrounding Dreamforce 2024…

    Customer Experience, Dreamforce 2024, Dreamforce 2024 Technology, Dreamforce AI, Dreamforce AI Solutions
    Grazitti Sep 6, 2024
    935  Views
    Steps To Connect Marketing Cloud & Salesforce Org

    Steps To Connect Marketing Cloud and Salesforce Org

    Blog in Salesforce Cloud Platform, Salesforce Implementation

    Before installing Marketing Cloud Connect, you need to keep the following Things in your mind - Review the Features page to understand compatibility and product versions. Marketing…

    Connect Marketing Cloud and Salesforce Org, Install Marketing Cloud, Marketing Cloud, Marketing Cloud Consultant, Permission Sets in Salesforce
    Rajan Mar 7, 2018
    41,771  Views
    Smart Dynamic Forms for Salesforce

    Smart Dynamic Forms for Salesforce

    Blog in Salesforce integration

    Do it yourself - Dynamic forms, conditional logic and realtime field population for salesforce without writing a single line of code. When working with online…

    Salesforce Forms
    Ori Sep 19, 2017
    9,265  Views

    Popular Salesforce Videos

    How you can Increase your Salesforce Efficiency and Productivity

    How you can Increase your Salesforce Efficiency and Productivity

    Video in Salesforce Training

    In this video, Brad discusses how to increase your workplace efficiency and productivity using various Google Chrome extensions and techniques. As always, we have linked…

    Salesforce Developer, salesforce, SFDC, Salesforce.com, Google Chrome
    Bradley Jun 3, 2020
    2,210  Views
    What are Cross Object Formula fields in Salesforce?

    What are Cross Object Formula fields in Salesforce?

    Video in Salesforce Development

    In this video, Cross Object Formula Fields in Salesforce is explained by dividing this topic into 4 basic points, which are: 1. What is Cross…

    Salesforce Field Objects, How To Learn Salesforce Development, Salesforce Learning Steps For Beginners, Easy Way To Learn Salesforce, Best Salesforce Tutorials
    Portia Jan 17, 2019
    2,783  Views
    Hands-on Experience in Salesforce

    Hands-on Experience in Salesforce

    Video in Salesforce Training

    How to get Hands-on experience in Salesforce? Watch this video to learn all about it.

    Salesforce Training, Salesforce Administration, Salesforce Online Training, Salesforce Developer, Salesforce Lightning Experience
    CRS Aug 17, 2022
    2,027  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.