Blogs
-
What is the most effective method to verify if person accounts are enabled through Apex Code?
QUESTION I need to be able to check if an org has Person Accounts enabled via Apex Code as part of package. What’s the best way to do this without making the package require Person Accounts be enabled in any org in which it’s installed? ANSWER Method 1 Try to access the isPersonAccount property on an Account and catch any exception that occurs…
-
How can we know State and Country Picklist is enabled or not in an org using Apex Code
Question How can we know State and Country Picklist is enabled in the Salesforce org or not using Apex code SOLUTION When you enable that feature SFDC creates a countryCode field for each object where the address exists. Then you could check if that field exist using something like this: Other generic option:
-
How To Access Country & State Picklist Values In Apex
Description This article gives you sample code to access the state and country pick-list values if it is enabled in your Salesforce org. Solution Makes sure the state and country picklist is enabled in the ORG. 1. Following is the sample code for accessing all the country codes: 2. Following is the sample code for…