1

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?

1 Answer 1

2

Setting the filterId resets the query. You can't use both an arbitrary query and a filter at once. Using one wipes the other. Instead, you'll have to start with the filterId, get all of the returned records' Id values, then build the other query using the Id values from the prior step.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .