Skip to content
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

copy currency code to new account #4141

Merged
merged 17 commits into from
Apr 2, 2019

Conversation

patrick-yan-sf
Copy link
Contributor

@patrick-yan-sf patrick-yan-sf commented Mar 22, 2019

Critical Changes

Changes

  • When NPSP automatically creates a Household Account from a new Contact, the newly created Account's currency field is populated with the currency field of the Contact (in organizations with multi-currency enabled). Previously, this was not the case. Thank you to Matt Parlane (@mattparlane) for your contributions to this enhancement.

Issues Closed

New Metadata

Deleted Metadata

@patrick-yan-sf
Copy link
Contributor Author

**lurch: add W-031981

@LurchTheButler
Copy link

Tracking W-032112

@patrick-yan-sf
Copy link
Contributor Author

@mattparlane, Thank you for your contribution. We have incorporated your suggestion with changes for orgs without multi-currency enabled. Please let us know if there are any questions.

@mattparlane
Copy link

Vunderbar! Any idea what version it will be included in? I'd like to let my people know when it's released.

@patrick-yan-sf
Copy link
Contributor Author

@sam-knox can you review the changes section to make sure the wording is correct . Thanks

Copy link
Contributor

@sam-knox sam-knox left a comment

Choose a reason for hiding this comment

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

I've updated the Changes for this PR.

@patrick-yan-sf
Copy link
Contributor Author

Vunderbar! Any idea what version it will be included in? I'd like to let my people know when it's released.

@mattparlane - It is scheduled to be in the next release

@patrick-yan-sf
Copy link
Contributor Author

**lurch: attach W-031981

@LurchTheButler
Copy link

Tracking W-031981

String defaultCurrency = UserInfo.getDefaultCurrency();

Contact newContact = new Contact(
lastname = 'CurrencyTest',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use CamelCase for fields API names, ie LastName and FirstName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RadSFDeveloper Thanks. I've updated the names

@@ -560,6 +560,11 @@ public class ACCT_IndividualAccounts_TDTM extends TDTM_Runnable {
a.Phone = c.Phone;
a.Fax = c.Fax;
a.OwnerId = c.OwnerId;

if (UserInfo.isMultiCurrencyOrganization()) {
a.put('CurrencyIsoCode', String.valueOf(c.get('CurrencyIsoCode')));
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's cast into String, ie a.put('CurrencyIsoCode', (String) c.get('CurrencyIsoCode'));

* @description Accounts created from the trigger should populate the currency code with the contact
*/
@IsTest
private static void accountCreatedWithCorrectCurrencyCodes() {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldPopulateNewAccountCurrencyWithContactCurrency()?


String qryString = 'SELECT Id, Name' + currencyField + ' FROM Account LIMIT 1';
Account newAccount = Database.query(qryString);
System.assertNotEquals(null, newAccount, 'New Account was not created');
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's specify expected state in the assert statements. For example: New Account should be created or Account Currency should be populated.

if (isMultiCurrencyEnabled) {

// Set currency to be something different than the default one if possible
List<SObject> currencies = Database.query('SELECT IsoCode FROM CurrencyType WHERE IsActive = True');
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using UTIL_UnitTestData_TEST.nonDefaultCurrencyType for this test? See similar tests in PMT_Payment_TEST.

Patrick Yan added 2 commits March 25, 2019 16:00
…ub.com:SalesforceFoundation/Cumulus into feature/pyan/populate-currency-field-on-create
@patrick-yan-sf
Copy link
Contributor Author

@RadSFDeveloper - I've made the requested changes. Thanks

Copy link
Contributor

@RadSFDeveloper RadSFDeveloper left a comment

Choose a reason for hiding this comment

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

Looks good!

@patrick-yan-sf
Copy link
Contributor Author

@rponti-sforg This is ready for QA. Thanks

@rponti-sforg rponti-sforg added the QE - Test QE is actively testing WI associated with PR label Apr 2, 2019
Copy link
Contributor

@rponti-sforg rponti-sforg left a comment

Choose a reason for hiding this comment

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

QE testing has been completed for this PR. Tests have passed.

For further testing details, see: https://foundation.lightning.force.com/lightning/r/agf__ADM_Work__c/a2x1E000008LlirQAC/view

Merging PR and deleting branch.

@rponti-sforg rponti-sforg merged commit 7f23e7a into master Apr 2, 2019
@rponti-sforg rponti-sforg deleted the feature/pyan/populate-currency-field-on-create branch April 2, 2019 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QE - Test QE is actively testing WI associated with PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants