SalesforceFoundation / Volunteers-for-Salesforce

Volunteers for Salesforce managed package
BSD 3-Clause "New" or "Revised" License
91 stars 93 forks source link

PersonalSiteReportHours Page: Some Jobs May Not Be Displayed if More than 999 Active Jobs #485

Open jesslopez-sf opened 4 years ago

jesslopez-sf commented 4 years ago

When customer orgs have more than 999 active Volunteer Jobs, it is possible that some volunteers' Jobs will not display on the Report Hours Personal Site Page.

This is because we cap Volunteer Jobs at 999 in this SOQL query:


SELECT Name, Id, 
    (SELECT Id, GW_Volunteers__Contact__c 
    FROM GW_Volunteers__Volunteer_Hours__r 
    WHERE GW_Volunteers__Contact__c = '003xxxxxxxxxxxx' LIMIT 1) 
FROM GW_Volunteers__Volunteer_Job__c 
WHERE (GW_Volunteers__Campaign__r.IsActive = TRUE 
    AND GW_Volunteers__Inactive__c = FALSE) 
ORDER BY name ASC NULLS FIRST
LIMIT 999

It only returns 999 Volunteer Jobs and then only adds those Volunteer Jobs where the Contact is the Id of the Contact passed in to the drop-down menu. I ran the query in the Dev Console’s Query Editor and confirmed that only 5 of the jobs returned were associated with the Contact in the customer org. When I changed the limit to 20000, on the other hand, more Jobs associated with that Contact were returned.

This is happening in VOL_CTRL_VolunteersReportHours.cls, lines 171-178. We then add the matching jobs for that Contact in lines 185-193.

Steps to Repeat in Scratch Org:

jesslopez-sf commented 4 years ago

**lurch: add

LurchTheButler commented 4 years ago

Tracking W-040031