Skip to content

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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

tcdahlberg
Copy link
Contributor

Critical Changes

Changes

  • Fields added to Event object that mirror fields created for lead and contact matching to facilitate person account matching controls: Custom_Metadata_Person_Account_Matching__c, Person_Creation_Duplicate_Rule__c, Person_Matching_Duplicate_Rule__c, Person_Matching_No_Match_Behaviour__c, Person_Matching_Rules__c
  • A new field was added to the event object to control whether matching will happen for guest a registrant adds during registration: Use_Matching_for_Guest_Registrations__c
  • Person account field added to registration: Person_Account__c, New_Person_Account_Created__c
  • SummitEventsContactMatching class totally rewritten to bulkify queries better and to make more shared methods for all matching processes. The later became important to get test coverage in orgs whether they had person accounts active or not.
  • Apex Unit tests updated for new person account matching feature
  • Matching trigger now triggers on update as well as insert to facilitate guest registrant matching (guest registrations only are inputted at the end of the registration process).
  • scratch org structure added for education cloud so that you can define it in cumulusci.yml file
  • method added to SummitEventsShard to identify if an org has person account enabled
  • Rudimentary robot tests have been added for future expansion later

Issues Closed

@tcdahlberg tcdahlberg requested a review from rdblake21 May 5, 2025 14:38
Comment on lines 622 to 635
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;
}
Copy link
Contributor

@DavidCuentasMar DavidCuentasMar May 6, 2025

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 👍

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Person Account functionality so SEA works with new Education Cloud and Nonprofit Cloud
2 participants