diff --git a/force-app/main/default/classes/ProgramEngagementSelector.cls b/force-app/main/default/classes/ProgramEngagementSelector.cls index 8af383208..0ab9ccdfc 100755 --- a/force-app/main/default/classes/ProgramEngagementSelector.cls +++ b/force-app/main/default/classes/ProgramEngagementSelector.cls @@ -72,7 +72,8 @@ public with sharing class ProgramEngagementSelector { public List getProgramEngagementsByProgramId( Id programId, Set fields, - Set stages + Set stages, + Integer engagementLimit ) { if ( !(Schema.SObjectType.ProgramEngagement__c.isAccessible() && @@ -84,8 +85,8 @@ public with sharing class ProgramEngagementSelector { return new List(); } - Integer limitTo = - System.Limits.getLimitQueryRows() - System.Limits.getQueryRows(); + // Integer limitTo = + // System.Limits.getLimitQueryRows() - System.Limits.getQueryRows(); queryBuilder .reset() @@ -95,7 +96,7 @@ public with sharing class ProgramEngagementSelector { String.valueOf(ProgramEngagement__c.Program__c) + ' = :programId' ) .addCondition(String.valueOf(ProgramEngagement__c.Stage__c) + ' IN :stages') - .withLimit(limitTo); + .withLimit(engagementLimit); List programEngagements = Database.query( queryBuilder.buildSoqlQuery() diff --git a/force-app/main/default/classes/ServiceScheduleCreatorController.cls b/force-app/main/default/classes/ServiceScheduleCreatorController.cls index ae57ce2ee..162fd1558 100644 --- a/force-app/main/default/classes/ServiceScheduleCreatorController.cls +++ b/force-app/main/default/classes/ServiceScheduleCreatorController.cls @@ -47,9 +47,9 @@ public with sharing class ServiceScheduleCreatorController { } @AuraEnabled(cacheable=true) - public static SelectParticipantModel getSelectParticipantModel(Id serviceId) { + public static SelectParticipantModel getSelectParticipantModel(Id serviceId, Integer engagementLimit) { try { - return service.getSelectParticipantModel(serviceId); + return service.getSelectParticipantModel(serviceId, engagementLimit); } catch (Exception ex) { throw Util.getAuraHandledException(ex); } diff --git a/force-app/main/default/classes/ServiceScheduleService.cls b/force-app/main/default/classes/ServiceScheduleService.cls index 0c7517f06..257f52b27 100644 --- a/force-app/main/default/classes/ServiceScheduleService.cls +++ b/force-app/main/default/classes/ServiceScheduleService.cls @@ -98,9 +98,9 @@ public with sharing class ServiceScheduleService { domain.insertParticipants(engagements, schedule); } - public SelectParticipantModel getSelectParticipantModel(Id serviceId) { + public SelectParticipantModel getSelectParticipantModel(Id serviceId, Integer engagementLimit) { SelectParticipantModel model = new SelectParticipantModel(); - loadAndPopulateParticipantRecords(serviceId, model); + loadAndPopulateParticipantRecords(serviceId, model, engagementLimit); return model; } @@ -248,7 +248,8 @@ public with sharing class ServiceScheduleService { private void loadAndPopulateParticipantRecords( Id serviceId, - SelectParticipantModel model + SelectParticipantModel model, + Integer engagementLimit ) { model.program = programEngagementSelector.getProgramByServiceId(serviceId); if (model.program == null) { @@ -262,7 +263,8 @@ public with sharing class ServiceScheduleService { model.programEngagements = programEngagementSelector.getProgramEngagementsByProgramId( model.program.Id, getSelectFieldsWithToLabel(model), - progEngagementService.getActiveStages() + progEngagementService.getActiveStages(), + engagementLimit ); } diff --git a/force-app/main/default/lwc/participantSelector/participantSelector.html b/force-app/main/default/lwc/participantSelector/participantSelector.html index 2fb913c4c..d3f817a40 100644 --- a/force-app/main/default/lwc/participantSelector/participantSelector.html +++ b/force-app/main/default/lwc/participantSelector/participantSelector.html @@ -76,6 +76,16 @@ onclick={handleSelectAll} > + + + ENGAGEMENT_LIMIT); this.loadTable(result.data); this.loadTableRows(result.data); this.loadPreviousSelections(); @@ -207,7 +210,7 @@ export default class ParticipantSelector extends LightningElement { loadTableRows(data) { let selectedIds = this.selectedEngagements.map(engagement => engagement.Id); - this.allEngagements = data.programEngagements.slice(0); + this.allEngagements = data.programEngagements.slice(0, ENGAGEMENT_LIMIT); this.availableEngagementRows = this.allEngagements .filter(engagement => !selectedIds.includes(engagement.Id))