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
jdk4702jdk4702 

VF Button for List View - Get checked rows. Error: Illegal view Id...

I'm attempting to implement this method to create a List View button that gets the selected rows & pass them to another method, but I'm getting an error :

 

 

Illegal view ID runSelectedRules. The ID must begin with /

 

Are these buttons supposed to return a page reference?  If so, how to I get the list view ID to return to the page after the controller method completes?

 

 

My List View button points to this VF page:

 

<apex:page standardController="Replacer__c" recordSetVar="r" extensions="replacerRunAllSelectedRulesController" action="runSelectedRules">
    
</apex:page>

 

 

Which call this controller when clicked:

 

public with sharing class replacerRunAllSelectedRulesController{

    ApexPages.StandardSetController setCon;

    public replacerRunAllSelectedRulesController(ApexPages.StandardController controller) {
        //Not sure why this is needed...
    }//replacerRunAllSelectedRulesController

    public replacerRunAllSelectedRulesController(ApexPages.StandardSetController controller) {
        setCon=controller;
    }//replacerRunAllSelectedRulesController
    
    public PageReference runSelectedRules(){
        List<Replacer__c> selectedRules=new List<Replacer__c>();
        for(sObject s: setCon.getSelected()){
            Replacer__c r=(Replacer__c)s;
            selectedRules.add(r);
        }//for 1
        String objectName='';
        Boolean sendEmail=TRUE;
        Integer numJobsCantBeRunNow=replacerExecute.replacerQueueBatchJobs(objectName, selectedRules, sendEmail);
        
//        return ApexPages.CurrentPage();
    }//runSelectedRules
    
}//replacerRunAllSelectedRulesController

I've tried other combo's too - putting the code in the set controller init and calling init, trying to return a different page ref, trying to return no pageref, but haven't hit anything that works yet :(

 

I should add that in all of my iterations, the debug logs show all the code runs, but nothing actually happens (methods aren't committed?).

Best Answer chosen by Admin (Salesforce Developers) 
Imran MohammedImran Mohammed

Make this change. The notation for calling an action from VF page action="{!controllermethod}"

Let me know if you face any issues.

action="{!runSelectedRules}"/>

All Answers

Imran MohammedImran Mohammed

Make this change. The notation for calling an action from VF page action="{!controllermethod}"

Let me know if you face any issues.

action="{!runSelectedRules}"/>
This was selected as the best answer
jdk4702jdk4702

Wow -that was dumb of me!  That did the trick!