Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Updating logic when overriding Contact Address to fix StateCode issue #7285

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

lparrott
Copy link
Contributor

Critical Changes

Changes

Issues Closed

Community Ideas Delivered

Features Intended for Future Release

Features for Elevate Customers

New Metadata

Deleted Metadata

Copy link
Contributor

@daniel-fuller daniel-fuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple comments

@@ -2560,6 +2560,7 @@ public with sharing class ADDR_Addresses_TEST {
MailingStreet__c, MailingCity__c, MailingState__c,
MailingPostalCode__c, MailingCountry__c
FROM Address__c
ORDER BY Name DESC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lparrott what was the reason for adding the order by here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, one of the tests was failing. We originally were ordering by MalingState, but had to remove that for encryption reasons. This ensures the order of Addresses for testing purposes, but we could figure out a way to remove it.

newAddress.MailingState__c = contact.MailingState;
newAddress.MailingPostalCode__c = contact.MailingPostalCode;
newAddress.MailingCountry__c = contact.MailingCountry;
Address__c newAddress = new NPSP_Address(contact).getRecord();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lparrott could you explain a little how this is preserving the country/state picklist codes? Is it because NPSP_Address uses that copyFromSObject which checks for state/country enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly why!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it ends up in this method, which does respect State and Country Pick Lists: https://github.com/SalesforceFoundation/NPSP/blob/main/force-app/main/default/classes/NPSP_Address.cls#L334

@lparrott lparrott merged commit 122116c into feature/256 Mar 27, 2025
7 of 12 checks passed
@lparrott lparrott deleted the feature/256__contactStateCodeFix branch March 27, 2025 22:04
@salesforce-org-metaci salesforce-org-metaci bot mentioned this pull request Mar 27, 2025
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.

3 participants