-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
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.
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 |
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.
@lparrott what was the reason for adding the order by here?
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.
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(); |
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.
@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?
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.
That's exactly why!
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.
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
Critical Changes
Changes
Issues Closed
Community Ideas Delivered
Features Intended for Future Release
Features for Elevate Customers
New Metadata
Deleted Metadata