Skip to content

Instantly share code, notes, and snippets.

@victorabraham
Created November 15, 2021 15:55
Show Gist options
  • Save victorabraham/72a5571e49efe661c6446a5e85a7b9d4 to your computer and use it in GitHub Desktop.
Save victorabraham/72a5571e49efe661c6446a5e85a7b9d4 to your computer and use it in GitHub Desktop.
public with sharing class PackageUtils {
private static Set<String> AccountFields = null;
//Method to check if person account is enabled
public static Boolean isPersonAccountEnabled() {
if (AccountFields == null) {
AccountFields = Schema.SObjectType.Account.fields.getMap().keyset();
}
return AccountFields.contains('ispesonaccount');
}
//Method to check if State and Country picklist is enabled
public static Boolean isStateAndCountryPicklistEnabled() {
if (AccountFields == null) {
AccountFields = Schema.SObjectType.Account.fields.getMap().keyset();
}
return AccountFields.contains('shippingcountrycode');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment