Skip to content

Commit 4b97f4a

Browse files
authored
V1.3.6 - Flow & MultiCurrency bugfixes (#177)
* Fixes #174 by preventing a pass by reference issue in RollupFlowBulkProcessor reported by @rygramer * Fixes #175 by removing the possibility for a divide by zero MathException * Fixing PMD issue in RollupCurrencyInfo * Adding extra negative test for RollupCurrencyInfo * Bumping package version from Github Action
1 parent 3b12234 commit 4b97f4a

12 files changed

+248
-117
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ You have several different options when it comes to making use of `Rollup`:
2121

2222
## Deployment
2323

24-
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ShhXAAS">
24+
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008Shn7AAC">
2525
<img alt="Deploy to Salesforce"
2626
src="./media/deploy-package-to-prod.png">
2727
</a>
2828

29-
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ShhXAAS">
29+
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008Shn7AAC">
3030
<img alt="Deploy to Salesforce Sandbox"
3131
src="./media/deploy-package-to-sandbox.png">
3232
</a>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@IsTest
2+
private class RollupCurrencyInfoTests {
3+
@IsTest
4+
static void shouldNotHitDivideByZeroError() {
5+
RollupCurrencyInfo mockUsdInfo = new RollupCurrencyInfo();
6+
mockUsdInfo.ConversionRate = 0;
7+
mockUsdInfo.DecimalPlaces = 2;
8+
mockUsdInfo.IsoCode = 'USD';
9+
10+
RollupCurrencyInfo mockEurInfo = new RollupCurrencyInfo();
11+
mockEurInfo.ConversionRate = 0;
12+
mockEurInfo.DecimalPlaces = 2;
13+
mockEurInfo.IsoCode = 'EUR';
14+
15+
RollupCurrencyInfo.mockCurrencyData = new Map<String, RollupCurrencyInfo>{ mockUsdInfo.IsoCode => mockUsdInfo, mockEurInfo.IsoCode => mockEurInfo };
16+
Opportunity opp = new Opportunity(Amount = 0);
17+
18+
RollupCurrencyInfo.setCurrencyIsoCode(opp, mockUsdInfo.IsoCode);
19+
RollupCurrencyInfo.transformForMultiCurrencyOrgs(opp, Opportunity.Amount, mockEurInfo.IsoCode, null);
20+
21+
opp = (Opportunity) RollupCurrencyInfo.getCalcItem(opp);
22+
System.assertEquals(0, opp.Amount, 'Should make it here without divide by zero error!');
23+
}
24+
25+
@IsTest
26+
static void shouldReturnSafeFallbackForCurrencyInfo() {
27+
RollupCurrencyInfo.IS_MULTICURRENCY = false;
28+
29+
RollupCurrencyInfo fallbackInfo = RollupCurrencyInfo.getCurrencyInfo('USD');
30+
31+
System.assertNotEquals(null, fallbackInfo);
32+
}
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<apiVersion>52.0</apiVersion>
4+
<status>Active</status>
5+
</ApexClass>

extra-tests/classes/RollupFlowBulkProcessorTests.cls

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ private class RollupFlowBulkProcessorTests {
33
@TestSetup
44
static void setup() {
55
upsert new RollupSettings__c(IsEnabled__c = true);
6+
Account acc = new Account(Name = RollupFlowBulkProcessorTests.class.getName());
7+
insert acc;
68
}
79

810
@IsTest
@@ -41,8 +43,7 @@ private class RollupFlowBulkProcessorTests {
4143

4244
@IsTest
4345
static void shouldProcessDeferredFlowRollups() {
44-
Account acc = new Account(Name = 'RollupFlowBulkProcessorTests');
45-
insert acc;
46+
Account acc = [SELECT Id FROM Account];
4647

4748
Rollup.defaultControl = new RollupControl__mdt(IsRollupLoggingEnabled__c = true);
4849
RollupFlowBulkProcessor.FlowInput input = new RollupFlowBulkProcessor.FlowInput();
@@ -74,8 +75,7 @@ private class RollupFlowBulkProcessorTests {
7475

7576
@IsTest
7677
static void shouldSyncRunFlowWhenToggled() {
77-
Account acc = new Account(Name = 'RollupFlowBulkProcessorTests');
78-
insert acc;
78+
Account acc = [SELECT Id FROM Account];
7979
Rollup.defaultControl = new RollupControl__mdt(IsRollupLoggingEnabled__c = true);
8080

8181
RollupFlowBulkProcessor.FlowInput input = new RollupFlowBulkProcessor.FlowInput();
@@ -149,7 +149,7 @@ private class RollupFlowBulkProcessorTests {
149149
input.rollupToUltimateParent = true;
150150
input.ultimateParentLookup = 'AccountId';
151151

152-
List<Rollup.FlowOutput> outputs = RollupFlowBulkProcessor.addRollup(new List<RollupFlowBulkProcessor.FlowInput>{ input });
152+
List<Rollup.FlowOutput> outputs = RollupFlowBulkProcessor.addRollup(new List<RollupFlowBulkProcessor.FlowInput>{ input });
153153

154154
System.assertEquals(1, outputs.size());
155155
System.assertEquals(true, outputs[0].isSuccess);
@@ -175,9 +175,52 @@ private class RollupFlowBulkProcessorTests {
175175
)
176176
};
177177

178-
List<Rollup.FlowOutput> outputs = RollupFlowBulkProcessor.addRollup(new List<RollupFlowBulkProcessor.FlowInput>{ input });
178+
List<Rollup.FlowOutput> outputs = RollupFlowBulkProcessor.addRollup(new List<RollupFlowBulkProcessor.FlowInput>{ input });
179179

180180
System.assertEquals(1, outputs.size());
181181
System.assertEquals(true, outputs[0].isSuccess, outputs);
182182
}
183+
184+
@IsTest
185+
static void shouldNotThrowValidationErrorsForUpdatesWithMultipleCmdtRecords() {
186+
Account acc = [SELECT Id FROM Account];
187+
188+
RollupFlowBulkProcessor.FlowInput input = new RollupFlowBulkProcessor.FlowInput();
189+
input.recordsToRollup = new List<SObject>{
190+
new Opportunity(Amount = 5, Id = RollupTestUtils.createId(Opportunity.SObjectType), AccountId = acc.Id),
191+
new Opportunity(Amount = 5, Id = RollupTestUtils.createId(Opportunity.SObjectType), AccountId = acc.Id)
192+
};
193+
input.rollupContext = 'UPSERT';
194+
input.oldRecordsToRollup = new List<SObject>{ null, null };
195+
input.deferProcessing = false;
196+
197+
Rollup.rollupMetadata = new List<Rollup__mdt>{
198+
new Rollup__mdt(
199+
RollupOperation__c = 'SUM',
200+
CalcItem__c = 'Opportunity',
201+
LookupObject__c = 'Account',
202+
RollupFieldOnCalcItem__c = 'Amount',
203+
LookupFieldOnCalcItem__c = 'AccountId',
204+
LookupFieldOnLookupObject__c = 'Id',
205+
RollupFieldOnLookupObject__c = 'AnnualRevenue'
206+
),
207+
new Rollup__mdt(
208+
RollupOperation__c = 'COUNT',
209+
CalcItem__c = 'Opportunity',
210+
LookupObject__c = 'Account',
211+
RollupFieldOnCalcItem__c = 'Id',
212+
LookupFieldOnCalcItem__c = 'AccountId',
213+
LookupFieldOnLookupObject__c = 'Id',
214+
RollupFieldOnLookupObject__c = 'NumberOfEmployees'
215+
)
216+
};
217+
218+
Test.startTest();
219+
RollupFlowBulkProcessor.addRollup(new List<RollupFlowBulkProcessor.FlowInput>{ input });
220+
Test.stopTest();
221+
222+
acc = [SELECT AnnualRevenue, NumberOfEmployees FROM Account];
223+
System.assertEquals(10, acc.AnnualRevenue, 'Account annual revenue should have summed properly');
224+
System.assertEquals(2, acc.NumberOfEmployees, 'Account number of employees should have counted properly');
225+
}
183226
}

extra-tests/classes/RollupIntegrationTests.cls

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@IsTest
22
private class RollupIntegrationTests {
3-
private static final Map<String, RollupCurrencyInfo> CURRENCY_TYPES = RollupCurrencyInfo.getCurrencyMap();
4-
53
@TestSetup
64
static void setup() {
75
Account acc = new Account(Name = RollupIntegrationTests.class.getName());
@@ -18,7 +16,7 @@ private class RollupIntegrationTests {
1816
AccountIdText__c = acc.Id,
1917
AccountId = acc.Id
2018
);
21-
setCurrencyIsoCode(opp, 'USD');
19+
RollupCurrencyInfo.setCurrencyIsoCode(opp, 'USD');
2220

2321
insert opp;
2422
upsert new RollupSettings__c(IsEnabled__c = true);
@@ -165,16 +163,16 @@ private class RollupIntegrationTests {
165163
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
166164
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
167165
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
168-
setCurrencyIsoCode(acc, 'EUR');
166+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
169167
update acc;
170168

171169
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
172170

173171
Opportunity eurOpp = usdOpp.clone(false, true);
174-
setCurrencyIsoCode(eurOpp, 'EUR');
172+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
175173
eurOpp.Amount = .95;
176174
Opportunity jpyOpp = eurOpp.clone(false, true);
177-
setCurrencyIsoCode(jpyOpp, 'JPY');
175+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
178176
jpyOpp.Amount = 100;
179177
insert new List<Opportunity>{ eurOpp, jpyOpp };
180178

@@ -198,10 +196,10 @@ private class RollupIntegrationTests {
198196
Test.stopTest();
199197

200198
acc = (Account) RollupTestUtils.queryRecord(acc.Id, new List<String>{ 'AnnualRevenue', 'MaxAmountRollupSummary__c' });
201-
Integer scaleSize = CURRENCY_TYPES.containsKey(getCurrencyIsoCode(acc)) ? CURRENCY_TYPES.get(getCurrencyIsoCode(acc)).DecimalPlaces : 2;
199+
RollupCurrencyInfo currencyInfo = RollupCurrencyInfo.getCurrencyInfo(getCurrencyIsoCode(acc));
202200
System.assertEquals(
203-
acc.MaxAmountRollupSummary__c.setScale(scaleSize),
204-
acc.AnnualRevenue.setScale(scaleSize),
201+
acc.MaxAmountRollupSummary__c.setScale(currencyInfo.DecimalPlaces),
202+
acc.AnnualRevenue.setScale(currencyInfo.DecimalPlaces),
205203
'Multi-currency MAX rollup not calculated correctly!'
206204
);
207205
}
@@ -211,16 +209,16 @@ private class RollupIntegrationTests {
211209
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
212210
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
213211
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
214-
setCurrencyIsoCode(acc, 'EUR');
212+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
215213
update acc;
216214

217215
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
218216

219217
Opportunity eurOpp = usdOpp.clone(false, true);
220-
setCurrencyIsoCode(eurOpp, 'EUR');
218+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
221219
eurOpp.Amount = .95;
222220
Opportunity jpyOpp = eurOpp.clone(false, true);
223-
setCurrencyIsoCode(jpyOpp, 'JPY');
221+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
224222
jpyOpp.Amount = 100;
225223
insert new List<Opportunity>{ eurOpp, jpyOpp };
226224

@@ -245,10 +243,10 @@ private class RollupIntegrationTests {
245243
Test.stopTest();
246244

247245
acc = (Account) RollupTestUtils.queryRecord(acc.Id, new List<String>{ 'AnnualRevenue', 'MinAmountRollupSummary__c' });
248-
Integer scaleSize = CURRENCY_TYPES.containsKey(getCurrencyIsoCode(acc)) ? CURRENCY_TYPES.get(getCurrencyIsoCode(acc)).DecimalPlaces : 2;
246+
RollupCurrencyInfo currencyInfo = RollupCurrencyInfo.getCurrencyInfo(getCurrencyIsoCode(acc));
249247
System.assertEquals(
250-
acc.MinAmountRollupSummary__c.setScale(scaleSize),
251-
acc.AnnualRevenue.setScale(scaleSize),
248+
acc.MinAmountRollupSummary__c.setScale(currencyInfo.DecimalPlaces),
249+
acc.AnnualRevenue.setScale(currencyInfo.DecimalPlaces),
252250
'Multi-currency MIN rollup not calculated correctly!'
253251
);
254252
}
@@ -258,16 +256,16 @@ private class RollupIntegrationTests {
258256
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
259257
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
260258
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
261-
setCurrencyIsoCode(acc, 'EUR');
259+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
262260
update acc;
263261

264262
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
265263

266264
Opportunity eurOpp = usdOpp.clone(false, true);
267-
setCurrencyIsoCode(eurOpp, 'EUR');
265+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
268266
eurOpp.Amount = .95;
269267
Opportunity jpyOpp = eurOpp.clone(false, true);
270-
setCurrencyIsoCode(jpyOpp, 'JPY');
268+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
271269
jpyOpp.Amount = 100;
272270
insert new List<Opportunity>{ eurOpp, jpyOpp };
273271

@@ -292,10 +290,10 @@ private class RollupIntegrationTests {
292290
Test.stopTest();
293291

294292
acc = (Account) RollupTestUtils.queryRecord(acc.Id, new List<String>{ 'AnnualRevenue', 'SumAmountRollupSummary__c' });
295-
Integer scaleSize = CURRENCY_TYPES.containsKey(getCurrencyIsoCode(acc)) ? CURRENCY_TYPES.get(getCurrencyIsoCode(acc)).DecimalPlaces : 2;
293+
RollupCurrencyInfo currencyInfo = RollupCurrencyInfo.getCurrencyInfo(getCurrencyIsoCode(acc));
296294
System.assertEquals(
297-
acc.SumAmountRollupSummary__c.setScale(scaleSize),
298-
acc.AnnualRevenue.setScale(scaleSize),
295+
acc.SumAmountRollupSummary__c.setScale(currencyInfo.DecimalPlaces),
296+
acc.AnnualRevenue.setScale(currencyInfo.DecimalPlaces),
299297
'Multi-currency SUM rollup not calculated correctly!'
300298
);
301299
}
@@ -305,16 +303,16 @@ private class RollupIntegrationTests {
305303
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
306304
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
307305
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
308-
setCurrencyIsoCode(acc, 'EUR');
306+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
309307
update acc;
310308

311309
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
312310

313311
Opportunity eurOpp = usdOpp.clone(false, true);
314-
setCurrencyIsoCode(eurOpp, 'EUR');
312+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
315313
eurOpp.Amount = .95;
316314
Opportunity jpyOpp = eurOpp.clone(false, true);
317-
setCurrencyIsoCode(jpyOpp, 'JPY');
315+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
318316
jpyOpp.Amount = 100;
319317
insert new List<Opportunity>{ eurOpp, jpyOpp };
320318

@@ -344,14 +342,13 @@ private class RollupIntegrationTests {
344342
for (SObject opp : opportunities) {
345343
convertedAmountSum += (Decimal) opp.get('ConvertedAmount');
346344
}
347-
Decimal conversionRate = CURRENCY_TYPES.containsKey(getCurrencyIsoCode(acc)) ? CURRENCY_TYPES.get(getCurrencyIsoCode(acc)).ConversionRate : 1;
348-
Decimal expectedAverage = (convertedAmountSum / opportunities.size()) * conversionRate;
345+
RollupCurrencyInfo currencyInfo = RollupCurrencyInfo.getCurrencyInfo(getCurrencyIsoCode(acc));
346+
Decimal expectedAverage = (convertedAmountSum / opportunities.size()) * currencyInfo.ConversionRate;
349347

350-
Integer scaleSize = CURRENCY_TYPES.containsKey(getCurrencyIsoCode(acc)) ? CURRENCY_TYPES.get(getCurrencyIsoCode(acc)).DecimalPlaces : 2;
351348
acc = (Account) RollupTestUtils.queryRecord(acc.Id, new List<String>{ 'AnnualRevenue' });
352349
System.assertEquals(
353-
expectedAverage.setScale(scaleSize),
354-
acc.AnnualRevenue.setScale(scaleSize),
350+
expectedAverage.setScale(currencyInfo.DecimalPlaces),
351+
acc.AnnualRevenue.setScale(currencyInfo.DecimalPlaces),
355352
'Multi-currency AVERAGE rollup not calculated correctly! Records: ' + opportunities
356353
);
357354
}
@@ -361,16 +358,16 @@ private class RollupIntegrationTests {
361358
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
362359
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
363360
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
364-
setCurrencyIsoCode(acc, 'EUR');
361+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
365362
update acc;
366363

367364
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
368365

369366
Opportunity eurOpp = usdOpp.clone(false, true);
370-
setCurrencyIsoCode(eurOpp, 'EUR');
367+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
371368
eurOpp.Amount = .95;
372369
Opportunity jpyOpp = eurOpp.clone(false, true);
373-
setCurrencyIsoCode(jpyOpp, 'JPY');
370+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
374371
jpyOpp.Amount = 100;
375372
insert new List<Opportunity>{ eurOpp, jpyOpp };
376373

@@ -416,16 +413,16 @@ private class RollupIntegrationTests {
416413
Account acc = (Account) RollupTestUtils.queryRecord('Account', new List<String>{ 'AnnualRevenue' });
417414
System.assertEquals(null, acc.AnnualRevenue, 'Test has started under the wrong conditions!');
418415
System.assertEquals('USD', getCurrencyIsoCode(acc), 'Test has started under the wrong conditions!');
419-
setCurrencyIsoCode(acc, 'EUR');
416+
RollupCurrencyInfo.setCurrencyIsoCode(acc, 'EUR');
420417
update acc;
421418

422419
Opportunity usdOpp = (Opportunity) RollupTestUtils.queryRecord('Opportunity', new List<String>{ 'StageName', 'CloseDate', 'Amount', 'AccountId' });
423420

424421
Opportunity eurOpp = usdOpp.clone(false, true);
425-
setCurrencyIsoCode(eurOpp, 'EUR');
422+
RollupCurrencyInfo.setCurrencyIsoCode(eurOpp, 'EUR');
426423
eurOpp.Amount = .95;
427424
Opportunity jpyOpp = eurOpp.clone(false, true);
428-
setCurrencyIsoCode(jpyOpp, 'JPY');
425+
RollupCurrencyInfo.setCurrencyIsoCode(jpyOpp, 'JPY');
429426
jpyOpp.Amount = 100;
430427
insert new List<Opportunity>{ eurOpp, jpyOpp };
431428

@@ -506,9 +503,9 @@ private class RollupIntegrationTests {
506503
// The CurrencyIsoCode field isn't directly used here, but the field will be automatically included by Rollup's queries,
507504
// so include it on the accounts so the asserts below show that the accounts do, in fact, match
508505
Account greatGrandparent = new Account(Name = 'Great-grandparent');
509-
setCurrencyISoCode(greatGrandparent, 'USD');
506+
RollupCurrencyInfo.setCurrencyIsoCode(greatGrandparent, 'USD');
510507
Account secondGreatGrandparent = new Account(Name = 'Second great-grandparent');
511-
setCurrencyISoCode(secondGreatGrandparent, 'USD');
508+
RollupCurrencyInfo.setCurrencyIsoCode(secondGreatGrandparent, 'USD');
512509
insert new List<Account>{ greatGrandparent, secondGreatGrandparent };
513510

514511
ParentApplication__c grandParent = new ParentApplication__c(Name = 'Grandparent', Account__c = greatGrandparent.Id);
@@ -1684,13 +1681,7 @@ private class RollupIntegrationTests {
16841681
System.assertNotEquals(null, jobId);
16851682
}
16861683

1687-
private static void setCurrencyISoCode(SObject record, String isoCode) {
1688-
if (UserInfo.isMultiCurrencyOrganization()) {
1689-
record.put('CurrencyIsoCode', isoCode);
1690-
}
1691-
}
1692-
16931684
private static String getCurrencyIsoCode(SObject record) {
1694-
return UserInfo.isMultiCurrencyOrganization() ? (String) record.get('CurrencyIsoCode') : 'USD';
1685+
return UserInfo.isMultiCurrencyOrganization() ? (String) record.get(RollupCurrencyInfo.CURRENCY_ISO_CODE_FIELD_NAME) : 'USD';
16951686
}
16961687
}

extra-tests/classes/RollupTestUtils.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class RollupTestUtils {
7979

8080
private static SObject queryRecord(Id recordId, String fromObject, List<String> fieldNames) {
8181
SObjectType sObjectType = recordId != null ? recordId.getSObjectType() : ((SObject) Type.forName(fromObject).newInstance()).getSObjectType();
82-
String currencyIscoCodeFieldName = 'CurrencyIsoCode';
82+
String currencyIscoCodeFieldName = RollupCurrencyInfo.CURRENCY_ISO_CODE_FIELD_NAME;
8383
if (fieldNames.contains('Id') == false) {
8484
fieldNames.add('Id');
8585
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apex-rollup",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"description": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
55
"repository": {
66
"type": "git",

rollup/core/classes/Rollup.cls

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,9 +2132,7 @@ global without sharing virtual class Rollup {
21322132
}
21332133

21342134
private static void winnowOldFlowRecords(FlowInput flowInput) {
2135-
if (flowInput.oldRecordsToRollup == null) {
2136-
flowInput.oldRecordsToRollup = new List<SObject>();
2137-
}
2135+
flowInput.oldRecordsToRollup = flowInput.oldRecordsToRollup == null ? new List<SObject>() : flowInput.oldRecordsToRollup.clone();
21382136
for (Integer index = flowInput.oldRecordsToRollup.size() - 1; index >= 0; index--) {
21392137
SObject oldRecord = flowInput.oldRecordsToRollup[index];
21402138
// record-triggered flows set up to run when "A record is created or modified"

0 commit comments

Comments
 (0)