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.7.3 - Fix Namespace Shadowing Issue #644

Merged
merged 2 commits into from
Jan 2, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ on:

jobs:
scratch-org-test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment: Test
steps:
# Checkout the code
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ As well, don't miss [the Wiki](../../wiki), which includes even more info for co

## Deployment & Setup

<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfXTAA0">
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfdwAAC">
<img alt="Deploy to Salesforce" src="./media/deploy-package-to-prod.png">
</a>

<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfXTAA0">
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008OfdwAAC">
<img alt="Deploy to Salesforce Sandbox" src="./media/deploy-package-to-sandbox.png">
</a>
<br/>
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.7.2",
"version": "1.7.3",
"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
4 changes: 2 additions & 2 deletions rollup-namespaced/sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"default": true,
"package": "apex-rollup-namespaced",
"path": "rollup-namespaced/source/rollup",
"versionName": "Fixes issue in RollupCalcItemReplacer where custom Type fields were incorrectly flagged as polymorphic",
"versionNumber": "1.2.2.0",
"versionName": "Fixes namespace shadowing issue in RollupFieldInitializer",
"versionNumber": "1.2.3.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
14 changes: 7 additions & 7 deletions rollup/core/classes/RollupFieldInitializer.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public virtual class RollupFieldInitializer {
return Datetime.newInstanceGmt(dt.yearGmt(), dt.monthGmt(), dt.dayGmt(), dt.hourGmt(), dt.minuteGmt(), dt.secondGmt());
}

public virtual Object getDefaultValue(SObjectField field) {
public virtual Object getDefaultValue(Schema.SObjectField field) {
DescribeFieldResult fieldDescribe = field.getDescribe();
if (fieldDescribe.isDefaultedOnCreate() && fieldDescribe.getDefaultValue() != null) {
return fieldDescribe.getDefaultValue();
Expand Down Expand Up @@ -55,7 +55,7 @@ public virtual class RollupFieldInitializer {
return initializedDefault;
}

public SObjectField getSObjectFieldByName(Map<String, SObjectField> fieldNameToField, String desiredField) {
public SObjectField getSObjectFieldByName(Map<String, Schema.SObjectField> fieldNameToField, String desiredField) {
if (fieldNameToField.containsKey(desiredField)) {
return fieldNameToField.get(desiredField);
} else if (fieldNameToField.containsKey(desiredField + 'Id')) {
Expand Down Expand Up @@ -83,9 +83,9 @@ public virtual class RollupFieldInitializer {
private List<String> activeVals;
private Map<String, Integer> picklistToRank;

public PicklistController(DescribeFieldResult fieldDescribe) {
public PicklistController(Schema.DescribeFieldResult fieldDescribe) {
super();
DisplayType fieldType = fieldDescribe?.getType();
Schema.DisplayType fieldType = fieldDescribe?.getType();
this.isPicklist = fieldType == DisplayType.MULTIPICKLIST || fieldType == DisplayType.PICKLIST;
this.isMultiSelectPicklist = fieldType == DisplayType.MULTIPICKLIST;

Expand All @@ -102,23 +102,23 @@ public virtual class RollupFieldInitializer {
List<Schema.PicklistEntry> picklistVals = fieldDescribe.getPicklistValues();

for (Integer index = 0; index < picklistVals.size(); index++) {
PicklistEntry picklist = picklistVals[index];
Schema.PicklistEntry picklist = picklistVals[index];
this.doBookkeepingOnPicklist(picklist);
// all inactive values will use -1 as a sentinel value
picklistToRank.put(picklist.getValue(), picklist.isActive() ? index : -1);
}
}
}

private void doBookkeepingOnPicklist(PicklistEntry picklist) {
private void doBookkeepingOnPicklist(Schema.PicklistEntry picklist) {
if (picklist.isDefaultValue() && this.activeVals.isEmpty()) {
this.activeVals.add(picklist.getValue());
} else if (picklist.isActive()) {
this.activeVals.add(picklist.getValue());
}
}

public override Object getDefaultValue(SObjectField field) {
public override Object getDefaultValue(Schema.SObjectField field) {
return this.isPicklist == false ? super.getDefaultValue(field) : this.activeVals[0];
}

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.7.2';
private static final String CURRENT_VERSION_NUMBER = 'v1.7.3';
private static final System.LoggingLevel FALLBACK_LOGGING_LEVEL = System.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 @@ -5,8 +5,8 @@
"package": "apex-rollup",
"path": "rollup",
"scopeProfiles": true,
"versionName": "Fixes issue in RollupCalcItemReplacer where custom Type fields were incorrectly flagged as polymorphic",
"versionNumber": "1.7.2.0",
"versionName": "Fixes namespace shadowing issue in RollupFieldInitializer",
"versionNumber": "1.7.3.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 @@
"[email protected]": "04t6g000008OfSEAA0",
"[email protected]": "04t6g000008OfTvAAK",
"[email protected]": "04t6g000008OfWQAA0",
"[email protected]": "04t6g000008OfXTAA0"
"[email protected]": "04t6g000008OfXTAA0",
"[email protected]": "04t6g000008OfdwAAC"
}
}