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’s the best way to check if person accounts are enabled via Salesforce Apex Code?

    Tagged: Account Object, HTTP GET, isPersonAccount, Metadata in Salesforce, Person Accounts, Property in Salesforce, Salesforce Accounts, Salesforce Apex Code, Salesforce Bundle, Salesforce Certification, Salesforce sObject

    • Salesforce® Discussions

      What’s the best way to check if person accounts are enabled via Salesforce Apex Code?

      Posted by shradha jain on July 27, 2018 at 9:29 AM

      What’s the best way to check if person accounts are enabled via Salesforce Apex Code?

      Parul replied 7 years, 4 months ago 4 Members · 3 Replies
      • Account Object
      • HTTP GET
      • isPersonAccount
      • Metadata in Salesforce
      • Person Accounts
      • Property in Salesforce
      • Salesforce Accounts
      • Salesforce Apex Code
      • Salesforce Bundle
      • Salesforce Certification
      • Salesforce sObject
    • 3 Replies
    • Avnish Yadav

      Member
      July 30, 2018 at 6:00 AM

      Hello Shradha,

      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.

    • shariq

      Member
      September 18, 2018 at 11:24 PM

      Hi,

      Try to access the 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.

      This method takes ~3.5ms and negligible heap space in my testing.

      Hope this helps.

    • Parul

      Member
      September 22, 2018 at 12:32 PM

      Hi

      Method 1:
      Endeavor to get to the is Person Account property on an Account and catch any exemption that happens if that property is absent. In the event that a special case is produced then individual records are handicapped. Else, they’re empowered. To abstain from making individual records required for the (Salesforce Certification Training) bundle you allocate the Account protest a subject and utilize subject. Get (‘is Person Account’) as opposed to getting to that property straightforwardly on the Account question.
      This method takes ~3.5ms and negligible heap space in my testing.

      Method 2:
      Use the account meta-data to check to see if the isPersonAccount field exists. I think this is a more elegant method but it executes a describe call which counts towards your governor limits. It’s also slightly slower and uses a lot more heap space.

      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

    How Nonprofits Benefit from Salesforce and Capsule Services

    Blog in Salesforce

    Like many businesses, nonprofits also benefit from using a CRM for managing their funding. While Salesforce for small businesses focuses mainly on sales and growing…

    Best Practices, Business, Capsule Eengagements, Capsule Engagement, Capsule Services
    Apphienz Nov 8, 2021
    2,268  Views

    Mastering Salesforce Marketing Cloud: The Ultimate Guide for Salesforce Marketing Cloud Consultants

    Blog in Others

    Introduction Businesses require strong marketing strategies in the digital era to survive in the cutthroat marketplace. Organizations can now build and carry out targeted, personalized…

    Automation, Automation Studio, Campaign Performance, Campaign Performance Analysis, Cloud Analogy
    Hennery cavil Jun 7, 2023
    1,609  Views
    Financial Services Cloud

    Relationships in Salesforce Financial Services Cloud

    Blog in Salesforce Admin

    Relationships. One might think that building a good relationship with Salesforce’s Financial Services Cloud would be harder than maintaining a personal relationship, but that is…

    AppExchange, Apps, Business Process, Client Records, Communication Fields
    rajesh andani Jun 1, 2022
    6,827  Views

    Popular Salesforce Videos

    Six Minute Salesforce : The Schema Object

    Six Minute Salesforce : The Schema Object

    Video in Salesforce Implementation, Salesforce Training

    The various objects and their relationships of a Salesforce application can be easily viewed using the Schema builder. Schema builder has a drag and drop…

    Salesforce Apex, Salesforce Online Training, Salesforce Training Videos, Salesforce Developer, Free Salesforce Training
    Nauman Mar 8, 2018
    1,871  Views
    Is Salesforce A Good Career For Freshers?

    Is Salesforce A Good Career For Freshers?

    Video in Salesforce Stories, Salesforce Training

    Wondering whether Salesforce is a good career for freshers or not? Here are all your answers. Join this useful group for Salesforce job & career…

    Salesforce Training, Salesforce Tutorial, Salesforce Jobs, salesforce, Salesforce Career
    Intelogik Sep 5, 2022
    1,384  Views
    How to Learn Salesforce Development | Salesforce learning steps for beginners | Trailhead demo

    How to Learn Salesforce Development | Salesforce learning steps for beginners | Trailhead demo

    Video in Salesforce Training, Trailhead

    In this video, we shared the steps to learn salesforce lightning basics, salesforce apex development, CRM in online for free from scratch very quickly. Learn salesforce…

    Salesforce Training, Salesforce Tutorial, salesforce training videos for beginners, How To Learn Salesforce Development, Salesforce Learning Steps For Beginners
    Shiv Kumar Sharma Jan 18, 2018
    2,875  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.