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

W-17216147 - 'First installment paid' checkbox not being set to true in Gift Entry #7266

Merged
2 changes: 1 addition & 1 deletion force-app/main/default/classes/GiftBatch.cls
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public inherited sharing class GiftBatch implements IGiftBatch {
private GiftTemplate giftTemplate;

private Boolean shouldPayFirstInstallment = false;
private static final String AllowFirstInstallmentPaid = 'AllowFirstInstallment__f';
private static final String AllowFirstInstallmentPaid = 'First installment paid';
Copy link
Contributor

Choose a reason for hiding this comment

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

@salesforce-suyash-more Will this break when the User is set to a non-English language? It looks like the geRD2FirstInstallmentPaid Label has translations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lparrott, your doubt about the translation issue was wise. I've made changes to ensure the FirstInstallmentPaid label is translation-compatible. Please review the latest updates.

Copy link
Contributor

Choose a reason for hiding this comment

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

@salesforce-suyash-more Unfortunately this still won't work in an multi-language org since the Template (in Batch_Defaults__c) gets stored in the running User's language, and then it would potentially get read back as a different language. Is there a reason the Batch_Defaults__c use field Labels and not API names as the key values? That seems to be the issue, did we change that in the past release?

Copy link
Contributor Author

@salesforce-suyash-more salesforce-suyash-more Dec 5, 2024

Choose a reason for hiding this comment

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

Hi @lparrott , Let's consider a scenario where a user using the English language creates a Gift Batch, which stores the 'First installment paid' English label in 'Batch_Defaults'. However, when a user from a different language (e.g. German) accesses the same Gift Batch and edits the 'Batch Info', the translated label will be updated in 'Batch_Defaults'.

The reason for using field labels in 'Batch_Defaults__c' stems from the bug fix related to W-14308598. This bug required replacing API names with field labels to distinguish between the ‘GAU Allocation 1’ and ‘GAU Allocation 2’ object group fields in the gift entry template. Since both object groups will have the same API names, it caused an issue of overriding form field values while setting defaults.
please refer to the Quip document for details of that bug.

Copy link
Contributor

Choose a reason for hiding this comment

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

@salesforce-suyash-more Thanks for that info, I forgot about that bug fix.
Are you saying the scenario you mentioned will work? That was my concern, an English User creates the Batch which stores the Labels as English, then a German User accesses it and our logic fails because it won't find the German translation of "geRD2FirstInstallmentPaid".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, @lparrott. The German user won't see the translated label in Batch_Defaults until they make an update in 'Batch Info'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lparrott, I made some changes to the logic for populating the Batch_Defaults, ensuring that the fieldApiName for the 'First installment paid' checkbox is stored in Batch_Defaults to resolve the translation issues with the labels.


@TestVisible
private GiftBatchSelector giftBatchSelector {
Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/lwc/geBatchWizard/geBatchWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) {
if (this.isEditMode && this._allowRecurringDonations) {
let batchLevelDefaults =
JSON.parse(this.dataImportBatchRecord.fields[DATA_IMPORT_BATCH_DEFAULTS_INFO.fieldApiName].value);
return batchLevelDefaults['AllowFirstInstallment__f'] ?
batchLevelDefaults['AllowFirstInstallment__f'].value :
return batchLevelDefaults['First installment paid'] ?
batchLevelDefaults['First installment paid'].value :
false;
}

Expand Down
Loading