3

Ok so I ran into something interesting today when trying to create a Visualforce button for the Task object. Everything was working gravy in Lightning. I was able to select records and everything passed in via the standard set controller just fine; however, when I tested it in Classic I received the following error:

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

Again, this is only in classic

Here's the code:

public with sharing class UpdateTaskOwnerExt {

    public List<SObject> selectedRecs {Get;Set;}


    public UpdateTaskOwnerExt(ApexPages.StandardSetController ssc) {
        try {
            this.selectedRecs = ssc.getSelected();
        } catch(Exception e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));}
    }

    public PageReference reAssignTasksToCurrentUser() {
        if (this.selectedRecs != null) {
            for (SObject act : this.selectedRecs) {
                act.put('OwnerId',UserInfo.getUserId());
            }
            update selectedRecords
        }
        PageReference pr;
        Map<String,String> params = ApexPages.currentPage().getParameters();
        if (params.containsKey('retUrl')) pr = new PageReference(params.get('retUrl'));
        if (params.containsKey('retURL')) pr = new PageReference(params.get('retURL'));
        if (params.containsKey('vfRetURLInSFX')) pr = new PageReference(params.get('vfRetURLInSFX'));
        if (pr != null) pr.setRedirect(true);
        return pr;
    }
}
2

I did come across this known issue on the SFDC side; however, it didn't specify if it was classic only or not. I'm hypothesizing that this is largely due to the fact that Lightning appears to process task list views different than classic. The list of "views" for classic is different from what we have available in Lightning. I think it's that key difference that is causing this.

When I queried the ListView table in Salesforce, it appears as if classic is storing list views under the "Activity" SObject type and Lightning is storing them specifically under the appropriate object (Task or Event). So my operating assumption is that when the controller passes in the filter, it's checking something like this:

SELECT Id, DeveloperName, Name, SObjectType FROM ListView WHERE SobjectType IN ('Task','Event')

So it's not finding the classic style list view where it's categorized as 'Actvity' instead of the explicit object type, so they would need to check for the listview as something like the following instead to get this (hopefully) working:

SELECT Id, DeveloperName, Name, SObjectType FROM ListView WHERE SobjectType IN ('Task','Event','Activity')

I'm going to be adding "LEX Only" to the button label to resolve this until SFDC can resolve the issue that I referenced earlier.

Also Salesforce appears to have snuck this in with Summer '18. Prior to API version 43, I get the following error:

core.apexpages.exceptions.ApexPagesHandledException: List controllers are not supported for Task 

Not sure what changed in Summer because it wasn't explicitly called out in anything I could see in the developer notes. The "Do More with Tasks from the List View " feature was added, and I'm wondering if they had to pigeon holed in to get the new functionality to work.

Anyways, I spent about good amount of time hunting for answers to this issue and the majority of them appeared to be around the fact that this functionality wasn't available (which was correct until Summer '18). So I thought I would share this with you all to help save you some time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.