Is it possible to deploy Apex code which uses Person Accounts to an org which doesn't have Person Accounts enabled?2019 Community Moderator ElectionWhat's the best way to check if person accounts are enabled via Apex Code?Multiple currency in Managed package without breaking support for non-currency orgs?Managed package with optional support for Orgs with Revenue Schedules enabledDetermine via Apex if product schedules are enabled for an OrgCustom fields and triggers for optional features in a managed packageBest practices for using person accounts within a managed packageManaged Package - check for Person Accounts with post install scriptDeploy metadata from one org to another using apexHow to check if Person Accounts enabled in a formula field in a Managed Package?How can we include managed package code into a site template which is defined in customer org

How can "mimic phobia" be cured or prevented?

Does IPv6 have similar concept of network mask?

Yosemite Fire Rings - What to Expect?

Why "had" in "[something] we would have made had we used [something]"?

Can I say "fingers" when referring to toes?

Why is this estimator biased?

Limits and Infinite Integration by Parts

15% tax on $7.5k earnings. Is that right?

Why did the EU agree to delay the Brexit deadline?

Quoting Keynes in a lecture

Are Captain Marvel's powers affected by Thanos' actions in Infinity War

What should you do if you miss a job interview (deliberately)?

I'm the sea and the sun

Why can Carol Danvers change her suit colours in the first place?

It grows, but water kills it

What are the advantages of simplicial model categories over non-simplicial ones?

Has any country ever had 2 former presidents in jail simultaneously?

Keeping a ball lost forever

Terse Method to Swap Lowest for Highest?

Why is the "ls" command showing permissions of files in a FAT32 partition?

Calculating total slots

Why does a simple loop result in ASYNC_NETWORK_IO waits?

How to explain what's wrong with this application of the chain rule?

Why should universal income be universal?



Is it possible to deploy Apex code which uses Person Accounts to an org which doesn't have Person Accounts enabled?



2019 Community Moderator ElectionWhat's the best way to check if person accounts are enabled via Apex Code?Multiple currency in Managed package without breaking support for non-currency orgs?Managed package with optional support for Orgs with Revenue Schedules enabledDetermine via Apex if product schedules are enabled for an OrgCustom fields and triggers for optional features in a managed packageBest practices for using person accounts within a managed packageManaged Package - check for Person Accounts with post install scriptDeploy metadata from one org to another using apexHow to check if Person Accounts enabled in a formula field in a Managed Package?How can we include managed package code into a site template which is defined in customer org










5















I want to create a managed package which supports orgs both with and without PersonAccounts enabled.



  1. Is it possible?

  2. How would I achieve this?









share|improve this question


























    5















    I want to create a managed package which supports orgs both with and without PersonAccounts enabled.



    1. Is it possible?

    2. How would I achieve this?









    share|improve this question
























      5












      5








      5








      I want to create a managed package which supports orgs both with and without PersonAccounts enabled.



      1. Is it possible?

      2. How would I achieve this?









      share|improve this question














      I want to create a managed package which supports orgs both with and without PersonAccounts enabled.



      1. Is it possible?

      2. How would I achieve this?






      apex managed-package person-accounts






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 19 at 7:25









      RobsRobs

      2,295537




      2,295537




















          1 Answer
          1






          active

          oldest

          votes


















          8















          Is it possible?




          Yes.




          How would I achieve this?




          You need to avoid using any "hard" references to any Person Account features. For example, you'll need to check if IsPersonType is a valid field:



          Boolean isPersonAccountsEnabled = sObjectType.RecordType.fields.getMap().containsKey('IsPersonType');


          Since this field is only present when you have Person Accounts enabled, you have to do dynamic queries to avoid making a hard link:



          RecordType[] personTypes = Database.query('SELECT Id FROM RecordType WHERE IsPersonType = true');


          And so on. You can read more about Dynamic Apex in the documentation.



          Finally, and I cannot stress this enough, always check the package dependencies before uploading. If you upload a version that includes dependencies to Person Accounts, you will never be able to undo it (at least, it's very hard to undo and involves Partner Support).



          You may want to put all your Person Account dependencies in to an Extension Package to avoid accidentally creating dependencies, but then you'd have to have customers install two separate packages.






          share|improve this answer























          • You sir are a scholar and a gentleman

            – Robs
            Mar 19 at 7:45










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "459"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f254386%2fis-it-possible-to-deploy-apex-code-which-uses-person-accounts-to-an-org-which-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          8















          Is it possible?




          Yes.




          How would I achieve this?




          You need to avoid using any "hard" references to any Person Account features. For example, you'll need to check if IsPersonType is a valid field:



          Boolean isPersonAccountsEnabled = sObjectType.RecordType.fields.getMap().containsKey('IsPersonType');


          Since this field is only present when you have Person Accounts enabled, you have to do dynamic queries to avoid making a hard link:



          RecordType[] personTypes = Database.query('SELECT Id FROM RecordType WHERE IsPersonType = true');


          And so on. You can read more about Dynamic Apex in the documentation.



          Finally, and I cannot stress this enough, always check the package dependencies before uploading. If you upload a version that includes dependencies to Person Accounts, you will never be able to undo it (at least, it's very hard to undo and involves Partner Support).



          You may want to put all your Person Account dependencies in to an Extension Package to avoid accidentally creating dependencies, but then you'd have to have customers install two separate packages.






          share|improve this answer























          • You sir are a scholar and a gentleman

            – Robs
            Mar 19 at 7:45















          8















          Is it possible?




          Yes.




          How would I achieve this?




          You need to avoid using any "hard" references to any Person Account features. For example, you'll need to check if IsPersonType is a valid field:



          Boolean isPersonAccountsEnabled = sObjectType.RecordType.fields.getMap().containsKey('IsPersonType');


          Since this field is only present when you have Person Accounts enabled, you have to do dynamic queries to avoid making a hard link:



          RecordType[] personTypes = Database.query('SELECT Id FROM RecordType WHERE IsPersonType = true');


          And so on. You can read more about Dynamic Apex in the documentation.



          Finally, and I cannot stress this enough, always check the package dependencies before uploading. If you upload a version that includes dependencies to Person Accounts, you will never be able to undo it (at least, it's very hard to undo and involves Partner Support).



          You may want to put all your Person Account dependencies in to an Extension Package to avoid accidentally creating dependencies, but then you'd have to have customers install two separate packages.






          share|improve this answer























          • You sir are a scholar and a gentleman

            – Robs
            Mar 19 at 7:45













          8












          8








          8








          Is it possible?




          Yes.




          How would I achieve this?




          You need to avoid using any "hard" references to any Person Account features. For example, you'll need to check if IsPersonType is a valid field:



          Boolean isPersonAccountsEnabled = sObjectType.RecordType.fields.getMap().containsKey('IsPersonType');


          Since this field is only present when you have Person Accounts enabled, you have to do dynamic queries to avoid making a hard link:



          RecordType[] personTypes = Database.query('SELECT Id FROM RecordType WHERE IsPersonType = true');


          And so on. You can read more about Dynamic Apex in the documentation.



          Finally, and I cannot stress this enough, always check the package dependencies before uploading. If you upload a version that includes dependencies to Person Accounts, you will never be able to undo it (at least, it's very hard to undo and involves Partner Support).



          You may want to put all your Person Account dependencies in to an Extension Package to avoid accidentally creating dependencies, but then you'd have to have customers install two separate packages.






          share|improve this answer














          Is it possible?




          Yes.




          How would I achieve this?




          You need to avoid using any "hard" references to any Person Account features. For example, you'll need to check if IsPersonType is a valid field:



          Boolean isPersonAccountsEnabled = sObjectType.RecordType.fields.getMap().containsKey('IsPersonType');


          Since this field is only present when you have Person Accounts enabled, you have to do dynamic queries to avoid making a hard link:



          RecordType[] personTypes = Database.query('SELECT Id FROM RecordType WHERE IsPersonType = true');


          And so on. You can read more about Dynamic Apex in the documentation.



          Finally, and I cannot stress this enough, always check the package dependencies before uploading. If you upload a version that includes dependencies to Person Accounts, you will never be able to undo it (at least, it's very hard to undo and involves Partner Support).



          You may want to put all your Person Account dependencies in to an Extension Package to avoid accidentally creating dependencies, but then you'd have to have customers install two separate packages.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 19 at 7:41









          sfdcfoxsfdcfox

          260k12207452




          260k12207452












          • You sir are a scholar and a gentleman

            – Robs
            Mar 19 at 7:45

















          • You sir are a scholar and a gentleman

            – Robs
            Mar 19 at 7:45
















          You sir are a scholar and a gentleman

          – Robs
          Mar 19 at 7:45





          You sir are a scholar and a gentleman

          – Robs
          Mar 19 at 7:45

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f254386%2fis-it-possible-to-deploy-apex-code-which-uses-person-accounts-to-an-org-which-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Marja Vauras Lähteet | Aiheesta muualla | NavigointivalikkoMarja Vauras Turun yliopiston tutkimusportaalissaInfobox OKSuomalaisen Tiedeakatemian varsinaiset jäsenetKasvatustieteiden tiedekunnan dekaanit ja muu johtoMarja VaurasKoulutusvienti on kestävyys- ja ketteryyslaji (2.5.2017)laajentamallaWorldCat Identities0000 0001 0855 9405n86069603utb201588738523620927

          Which is better: GPT or RelGAN for text generation?2019 Community Moderator ElectionWhat is the difference between TextGAN and LM for text generation?GANs (generative adversarial networks) possible for text as well?Generator loss not decreasing- text to image synthesisChoosing a right algorithm for template-based text generationHow should I format input and output for text generation with LSTMsGumbel Softmax vs Vanilla Softmax for GAN trainingWhich neural network to choose for classification from text/speech?NLP text autoencoder that generates text in poetic meterWhat is the interpretation of the expectation notation in the GAN formulation?What is the difference between TextGAN and LM for text generation?How to prepare the data for text generation task

          Is this part of the description of the Archfey warlock's Misty Escape feature redundant?When is entropic ward considered “used”?How does the reaction timing work for Wrath of the Storm? Can it potentially prevent the damage from the triggering attack?Does the Dark Arts Archlich warlock patrons's Arcane Invisibility activate every time you cast a level 1+ spell?When attacking while invisible, when exactly does invisibility break?Can I cast Hellish Rebuke on my turn?Do I have to “pre-cast” a reaction spell in order for it to be triggered?What happens if a Player Misty Escapes into an Invisible CreatureCan a reaction interrupt multiattack?Does the Fiend-patron warlock's Hurl Through Hell feature dispel effects that require the target to be on the same plane as the caster?What are you allowed to do while using the Warlock's Eldritch Master feature?