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
Rakesh ERakesh E 

Error while calling extensions methods in a page

Hi ,

 

iam facing an error as

 

Error: action="{!bumpContacts}": Unknown method 'ContactStandardController.bumpContacts()'

 

 same error iam getting even for deleteContacts() method

 

my visualForce page is 

 

<apex:page standardController="Contact" extensions="ContactController" recordSetVar="contacts" action="{!bumpContacts}">
<apex:form >
<apex:pageBlock title="Bump Selected Contacts">
<apex:pageBlockButtons >
<apex:commandButton action="{!deleteContacts}" value="Confirm"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="cntct">
<apex:column value="{!cntct.firstname}"/>
<apex:column value="{!cntct.lastname}"/>
<apex:column value="{!cntct.email}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and controller extension is

 

public  class ContactController 
{
    private ApexPages.StandardSetController standardController;
    public List<Contact> selectedContacts;

    public ContactController(ApexPages.StandardSetController standardController)
    {
        this.standardController = standardController;
    }

    public PageReference bumpContacts()
    {       
        // Get the selected records (optional, you can use getSelected to obtain ID's and do your own SOQL)
         selectedContacts = (List<Contact>) standardController.getSelected();

        return null;        
    }

    public PageReference deleteContacts()
    {       
        // Call StandardSetController 'save' method to update (optional, you can use your own DML)
        //return standardController.save();   
        try{
        
        delete selectedContacts ;
        }catch(system.exception ex){
        system.debug('exception occured ' + ex.getmessage());
        }
        return null;
    }
}

 

please let me know why the error is and if i did any mistake.

 

Regards,

Rakesh

Vinit_KumarVinit_Kumar

Rakesh,

 

I copy pasted your code in my org and it worked for me,not sure why you are getting the error.Could you double check??