I have made a custom rest endpoint which filters leads based on a Lead View: I want to use a Filter and a query, but it seems that when I apply the filter the query gets ignored, my current attempt is:
Database.QueryLocator ql = Database.getQueryLocator(query);
ApexPages.StandardSetController setController = new ApexPages.StandardSetController(ql);
setController.setpageNumber(pageNumber);
setController.setPageSize(pageSize);
setController.setFilterID(filterID);
setController.getRecords();
This code results in getting every object that exists in the LeadView represented by the FilterID regardless of the query I pass to the Database.getQueryLocator(), if I comment out "setController.setFilterID(filterID);" I get the results of just the query.
The desired result would be that I get only Leads that are returned from the query and are in the LeadView.
Is there a different way to query such that I can get the desired result?