-
Notifications
You must be signed in to change notification settings - Fork 57
NEW FEATURE: Person account matching #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ate/ctry picklist org enabled
…nts-App into person_account_matching2
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I think we could also use this option in case we don't want to fire exceptions:
return Schema.sObjectType.Account.fields.getMap().containsKey( 'isPersonAccount' );
I created a new scratch org and I tested both using anonymous window.
- try-catch example takes around 71.342 ms
- Schema approach takes around 16.284 ms
Both approaches are intuitive 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavidCuentasMar, love the efficiency! I'll make the change and test.
Critical Changes
Changes
Issues Closed