Based on the error I think you've been applying the new filter to the 1st query (camRecId
). But your "list of campaigns" is queried for below!
You don't really need that query, it can be simplified to something like this:
public class DirectMailfilter {
public List<campaign> dmcampaigns {get;private set;}
public DirectMailfilter(ApexPages.StandardsetController controller) {
dmcampaigns = [SELECT StartDate, Type, Status, Name
FROM Campaign
WHERE Type = 'Direct Mail'];
}
}
The query will be run only once (when the constructor runs on first page load) whereas in your old code you would send a query every time getter is called (for example every time you hit some form submission buttons).
You can read more about the getters/setters here