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

RollupService fails on Nonprofit Cloud's standard 'Program' object #1396

Closed
groundwired opened this issue Oct 16, 2023 · 5 comments · Fixed by #1398
Closed

RollupService fails on Nonprofit Cloud's standard 'Program' object #1396

groundwired opened this issue Oct 16, 2023 · 5 comments · Fixed by #1398
Labels

Comments

@groundwired
Copy link
Contributor

Describe the bug
When rolling up from a custom child object to the Nonprofit Cloud's standard 'Program' object, either via the child trigger or using the scheduled rollup job, the following Apex error occurs:

dlrs.RollupService.triggerHandler(Schema.SObjectType)
FATAL_ERROR|System.QueryException: sObject type 'Program' is not supported.

To Reproduce
Steps to reproduce the behavior:

  1. Create an org with the new Nonprofit Cloud and install DLRS. There will be a new standard object called 'Program'.
  2. Create a custom child object with a lookup to the standard 'Program' object.
  3. In DLRS, create a simple rollup that counts child records and saves to a number field on the parent. Make it a 'Realtime' rollup, install the child trigger, and activate.
  4. Add a new Program record, and then add a child record.
  5. See the following error message:

System.QueryException: sObject type 'Program' is not supported.

Expected behavior
This rollup works when running "Full Calculate" - it should also work with Realtime triggered calculations or scheduled rollups.

Screenshot 2023-10-16 at 1 21 21 PM

Additional context
The rollup works perfectly when we click Full Calculate - in other words, there's no problem with the aggregate query that is used by the rollup. The error occurs in a subsequent step - I assume it is when the DLRS code in RollupService tried to query or update the Program object.

Here is the actual query that it runs to do the rollup:
SELECT Target_Program__c, Count(Id) lre0 FROM Referral__c WHERE Target_Program__c in ('11WDp000000L04lMAC') AND (Referral_Date__c = LAST_N_DAYS:365) GROUP BY Target_Program__c

DLRS is running in v58.0 - I tried running my trigger in both 58.0 and 59.0 with the same result. I also tried running with User and System sharing mode with the same result.

Note that I also tried changing Calculation Mode to Scheduled. When the rollup service ran on schedule, it hit the same error as the triggered rollup. However, the Full Calculate still works fine.

I have no way of figuring out where the error occurs in the package, but in general I suspect two possible issues with the Nonprofit Cloud 'Program' object.

  1. Since this is a new object, it is possible that some Apex functionality isn't working properly in v58.0 (or maybe not working properly at all).
  2. My user has all the appropriate licenses and permsets to access the Program object, but it is possible that the Apex code is unable to use those objects or fields for some reason related to security or licensing.
@groundwired
Copy link
Contributor Author

I created an unmanaged org and reproduced the bug there. The reason this fails is that the RollupDmlGuard and RollupDmlGuardTest classes are still at v56.0. Until this is fixed, no objects released in v57.0 or later will be compatible.

@groundwired
Copy link
Contributor Author

I tested this update - it fixes the bug!

@aheber
Copy link
Contributor

aheber commented Oct 17, 2023

Fantastic find!

Rather than only updating the API versions, I'd like a chance to fix whatever it is in RollupDmlGuard that is making it API dependent. We've been slowly trying to make DLRS support objects that are ahead of it's API version so we don't have problems like this. I'd like to close this gap as well.

Can you provide reproduction steps or if you're so inclined, take a look at the class and give us a starting point for which parts seem to be causing the problem?

Copy link
Contributor

Included in beta release 2.20 (Beta 1)

aheber pushed a commit that referenced this issue Jan 10, 2024
Copy link
Contributor

Included in production release 2.20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants