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
serenityserenity 

apex:commandbutton action not firing

In my Visualforce page I'm using a standardController with the extensions=""

 

The Visualforce page is used as a custom List Button which allows users to select multiple records in an enhanced list.

 

I have a command button that is supposed to call a method, but for some reason, the method never gets fired.

 

Have set up some debug logs to see if there is any data at all, and nothing comes up in the debug. Any ideas on why this command won't fire properly would be appreciated.

 

<apex:page standardController="pse__Timecard__c" 
                   extensions="TimecardSplitButtons" 
                 recordSetVar="tcSplits">
    <apex:pageMessages />
    <apex:form >
        <apex:commandButton action="{!UnholdForBilling}" value="Unhold for Billing"/>
    </apex:form>
</apex:page>


public with sharing class TimecardSplitButtons {

    private ApexPages.StandardSetController ssc;

    // Local Variables
    public List<pse__Timecard__c> tcIds = new List<pse__Timecard__c>();

    // Constructor
    public TimecardSplitButtons(ApexPages.StandardSetController ssc) {
        this.ssc = ssc;
    }

    public void UnholdForBilling() {
        this.tcIds = this.ssc.getRecords();
        System.debug('3 - ' + this.tcIds.size());
        if (this.tcIds.size() > 0) {
            List<pse__Timecard__c> tcsValidate = [SELECT Id, pse__Timecard_Header__c,
                                                         pse__Timecard_Header__r.pse__Project__r.Id, pse__Timecard_Header__r.pse__Project__r.pse__Closed_for_Time_Entry__c,
                                                         pse__Timecard_Header__r.pse__Assignment__r.Id, pse__Timecard_Header__r.pse__Assignment__r.pse__Closed_for_Time_Entry__c
                                                    FROM pse__Timecard__c
                                                   WHERE Id IN :this.tcIds AND
                                                         pse__Billable__c = true AND
                                                         pse__Billed__c = false AND
                                                         pse__Approved__c = true AND
                                                         pse__Invoiced__c = false AND
                                                         pse__Total_Billable_Amount__c > 0];
            
...
...
...
        }
    }

}

 

 

 

kiranmutturukiranmutturu

i am able to get the debug log for ur code in my DE i.e command button is working .. and whats the use of recordsetvar there...?

serenityserenity

hmmm. Thanks for the update. There might be something else that is wrong with the org I'm working in.

 

To answer your question though, the only way I could get Standardsetcontroller to work was to use the recordSetVar=""

 

Don't know why.

 

Thanks once again. I'll follow up internally and see if there is anything that has changed on our org.

BaLab2aBaLab2a

 

Hi,
 
**Controller**
 
public Pagereference process()
{
UnholdForBilling();
return null;
}
 
 
**Visualforce**
 <apex:commandButton action="{!process}" value="Unhold for Billing"/>
 
 
Please Check whether it is helpful..
 
Thanks,
Bala