function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nimbusprojectnimbusproject 

core.apexpages.exceptions.ApexPagesHandledException: Filter Id value is not valid

 

I have a VisualForce page that has a "Listview' assigned via a "SelectList", when the view is selected, a Cookie is also created via an ActionSupport as such:

 

 

<apex:selectList styleClass="" value="{!filterId}" size="1">
<apex:actionSupport event="onchange" action="{!go}" onSubmit="update(this.value);" />
<apex:selectOptions value="{!listViewOptions}" />
</apex:selectList>

And in the controller:

 

 

public filterId {get; set;}

public Controller() {
        if (ApexPages.currentPage() != null && this.filterId == null) {
            Cookie FilterId = ApexPages.currentPage().getCookies().get('FilterId');
            
            if (FilterId != null) {
                this.filterId = FilterId.getValue();
            }    
        }
    }

public PageReference go() { this.errors = ''; // Remember the selected list view for 365 days Cookie FilterId = new Cookie('FilterId', this.filterId, null, 31536000, false); ApexPages.currentPage().setCookies(new Cookie[]{FilterId}); return null; }

 This works fine, and the controller is assigned correctly as well.

 

But, if I assign the filterId, but selecting it from the list, and than go BACK and 'choose the unselect' option, navigate away from the page and return to the domain where the cookie is: I get the following error:

 

core.apexpages.exceptions.ApexPagesHandledException: Filter Id value is not valid for the Campaign standard controller

 

I'm confused because I can't find 'Filter Id' (with the space anywhere, and the Cookie and the StandardSetController filter should be null as well - although I am seeing that the Cookie 'still exists' in the domain (is it just being 'Zeroed' out but not deleted or set to null if I can still see it? And than is it hanging on the standard constructor?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
nimbusprojectnimbusproject

Nevermind, I figured it out:

 

In case you are curious, the 'Cookie' wasn't being deleted when I navigated away from the page (to another tab). So I used a jQuery plugin to manually delete the Cookie COMPLETELY, not just set it to: ""

 

This avoids the error.