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

v1.6.7 - CDC updates #547

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extra-tests/classes/RollupFlowTests.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ private class RollupFlowTests {
RollupAsyncProcessor.stubParentRecords = new List<SObject>{ acc };

List<Rollup.FlowInput> flowInputs = RollupTestUtils.prepareFlowTest(new List<SObject>(), 'REFRESH', 'SUM');
flowInputs[0].recordsToRollup = null; // Get Records passes null for something that doesn't match
flowInputs[0].parentRecordIdForEmptyChildrenCollections = acc.Id;
flowInputs[0].calcItemTypeWhenRollupStartedFromParent = 'ContactPointAddress';

Expand Down
1 change: 0 additions & 1 deletion extra-tests/classes/RollupTests.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,6 @@ private class RollupTests {

EventBus.ChangeEventHeader header = new EventBus.ChangeEventHeader();
header.changeType = 'CREATE';
header.changedFields = new List<String>{ 'PreferenceRank', 'LastModifiedDate' };
header.recordIds = new List<Id>{ cpa.Id };
header.entityName = 'ContactPointAddress';
ContactPointAddressChangeEvent ev = new ContactPointAddressChangeEvent(ChangeEventHeader = header, PreferenceRank = 500);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apex-rollup",
"version": "1.6.6",
"version": "1.6.7",
"description": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion rollup-namespaced/sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"apex-rollup-namespaced@1.1.3": "04t6g000008Oa8lAAC",
"apex-rollup-namespaced@1.1.4": "04t6g000008Oa9ZAAS",
"apex-rollup-namespaced@1.1.5": "04t6g000008OaAcAAK",
"apex-rollup-namespaced@1.1.6": "04t6g000008OaFnAAK"
"apex-rollup-namespaced@1.1.6": "04t6g000008OaFnAAK",
"apex-rollup-namespaced@1.1.7": "04t6g000008OaHPAA0"
}
}
8 changes: 5 additions & 3 deletions rollup/core/classes/Rollup.cls
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,9 @@ global without sharing virtual class Rollup implements RollupLogger.ToStringObje
if (
flowInput.parentRecordIdForEmptyChildrenCollections != null &&
flowInput.calcItemTypeWhenRollupStartedFromParent != null &&
flowInput.recordsToRollup?.isEmpty() == true
flowInput.recordsToRollup?.isEmpty() != false
) {
flowInput.recordsToRollup = new List<SObject>();
Schema.DescribeSObjectResult childDescribe = RollupFieldInitializer.Current.getDescribeFromName(flowInput.calcItemTypeWhenRollupStartedFromParent);
SObject stubChild = childDescribe.getSObjectType().newSObject(childDescribe.getKeyPrefix() + '0'.repeat(12));
stubChild.put(flowInput.lookupFieldOnCalcItem, flowInput.parentRecordIdForEmptyChildrenCollections);
Expand Down Expand Up @@ -1629,7 +1630,8 @@ global without sharing virtual class Rollup implements RollupLogger.ToStringObje
return;
}

Set<String> uniqueFieldNames = new Set<String>();
Set<String> uniqueFieldNames = new Set<String>(firstRecord.getPopulatedFieldsAsMap().keySet());
uniqueFieldNames.remove('ChangeEventHeader');
RollupRepository.RunAsMode permissionLevel = RollupRepository.RunAsMode.SYSTEM_LEVEL;
for (Rollup__mdt rollupInfo : matchingMetadata) {
permissionLevel = RollupMetaPicklists.getAccessLevel(rollupInfo);
Expand All @@ -1641,7 +1643,7 @@ global without sharing virtual class Rollup implements RollupLogger.ToStringObje

// it would have been nice if this was an enum!
switch on header.changeType {
when 'CREATE', 'GAP_CREATE' {
when 'CREATE', 'GAP_CREATE', 'UNDELETE' {
apexContext = TriggerOperation.AFTER_INSERT;
}
when 'UPDATE', 'GAP_UPDATE' {
Expand Down
2 changes: 1 addition & 1 deletion rollup/core/classes/RollupFullRecalcProcessor.cls
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ global abstract without sharing class RollupFullRecalcProcessor extends RollupAs
protected override Boolean getCanRollupWithoutCustomSetting() {
Boolean canRollupWithoutCustomSetting = false;
for (Rollup__mdt rollupMeta : this.rollupMetas) {
canRollupWithoutCustomSetting = rollupMeta.ShouldRunWithoutCustomSettingEnabled__c == true;
canRollupWithoutCustomSetting = rollupMeta.ShouldRunWithoutCustomSettingEnabled__c;
// all included rollups need to have the override enabled; if even one does NOT, we can stop
if (canRollupWithoutCustomSetting == false) {
break;
Expand Down
2 changes: 1 addition & 1 deletion rollup/core/classes/RollupLogger.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
global without sharing virtual class RollupLogger implements ILogger {
@TestVisible
// this gets updated via the pipeline as the version number gets incremented
private static final String CURRENT_VERSION_NUMBER = 'v1.6.6';
private static final String CURRENT_VERSION_NUMBER = 'v1.6.7';
private static final LoggingLevel FALLBACK_LOGGING_LEVEL = LoggingLevel.DEBUG;
private static final RollupPlugin PLUGIN = new RollupPlugin();

Expand Down
7 changes: 4 additions & 3 deletions sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"default": true,
"package": "apex-rollup",
"path": "rollup",
"versionName": "Flow optimizations continued",
"versionNumber": "1.6.6.0",
"versionName": "CDC create updates",
"versionNumber": "1.6.7.0",
"versionDescription": "Fast, configurable, elastically scaling custom rollup solution. Apex Invocable action, one-liner Apex trigger/CMDT-driven logic, and scheduled Apex-ready.",
"releaseNotesUrl": "https://github.com/jamessimone/apex-rollup/releases/latest",
"unpackagedMetadata": {
Expand Down Expand Up @@ -108,6 +108,7 @@
"apex-rollup@1.6.3": "04t6g000008Oa8gAAC",
"apex-rollup@1.6.4": "04t6g000008Oa9UAAS",
"apex-rollup@1.6.5": "04t6g000008OaAXAA0",
"apex-rollup@1.6.6": "04t6g000008OaFiAAK"
"apex-rollup@1.6.6": "04t6g000008OaFiAAK",
"apex-rollup@1.6.7": "04t6g000008OaHKAA0"
}
}