+ Start a Discussion
Deepak Sharma 184Deepak Sharma 184 

In Visual force page- More button is not fetching records.

Hi,

I have a visual force page as shown below in which 'more' is redirect the user to details page of records. but for the block 'Task completed last week' more button is not working, for others it is working fine. any body can help

below is my vf page and controller:-


        <div class="main_container" style="margin-top:10px">
            <div class = "height:50%">
                <div class="animated flipInY col-lg-4 col-md-80 col-sm-80 col-xs-80">
                    <div class="tile-stats">
                        <div style="text-align:center">
                            <apex:outputLabel value="Task Completed Last Week" style="color:#0A31FB;" />
                        </div>
                        <apex:pageBlock >
                         
                            <apex:pageBlockTable value="{!rows}" var="tc" rows="3" rendered="{!rows.size>0}">
                                  
                                <apex:column >

                                    <a href= "/{!tc.id}">
                                    <!--apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tc.id)}" styleClass="leftAlign" >-->{!tc.Name}</a>
                                    <!--/apex:outputLink>-->
                            
                                </apex:column>
                              
                            </apex:pageBlockTable>
                            <!-- <apex:repeat>
                                 dsd
                            <apex:outputText value="There are no tasks to display." style="white-space:pre-wrap;border-hidden" />
                            </apex:repeat>-->

                        </apex:pageBlock>
                        <apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskcom}"
                        />
                    </div>
            </div>
            </div>
            </div>
   




        <div class="main_container" style="margin-top:10px">
                <div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
                    <div class="tile-stats">
                        <div style="text-align:center">
                            <apex:outputLabel value="Task In Progress" style="color:#0A31FB;" />
                        </div>
                        <apex:pageBlock >
                            <apex:pageBlockTable value="{!taskname}" var="t" rows="3" rendered="{!taskname.size>0}">
                                <apex:column >
                                    <a href= "/{!t.id}">
                                   <!-- <apex:param name="tcIP" value="{!t.Id}" />
                                    <apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, t.id)}" styleClass="leftAlign" >-->{!t.Name}</a>
                                    <!--</apex:outputLink>-->
                                </apex:column>
                            </apex:pageBlockTable>
                        </apex:pageBlock>
                        <apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskprj}"
                        />
                    </div>
                </div>
            </div>

        <div class="main_container" style="margin-top:10px">
              <div class="row top_tiles" style="text-align:center;">
            <div class="animated flipInY col-lg-4 col-md-2 col-sm-6 col-xs-12">
                <div class="tile-stats">
                    <div style="text-align:center">
                        <apex:outputLabel value="Tasks starting next week" style="color:#0A31FB;" />
                    </div>
                    <apex:pageBlock >
                         <apex:outputPanel layout="block" styleclass="container">

                        <apex:pageBlockTable value="{!taskPlan}" var="tp" rows="3" rendered="{!taskPlan.size>0}">
                            <apex:column >
                                
                                <a href= "/{!tp.id}">
                                <!--<apex:param name="tpId" value="{!tp.Id}" />
                                <apex:outputLink value="{!URLFOR($Action.CloudbyzITPM__Task__c.View, tp.id)}" styleClass="leftAlign" >-->{!tp.Name}</a>
                                <!--</apex:outputLink>-->
                            
                            </apex:column>
                        </apex:pageBlockTable>
                        </apex:outputPanel>
                    </apex:pageBlock>
                    <apex:commandButton styleClass="div5" value="more" action="{!redirecttoprjtskpln}"
                    />
                </div>
            </div>
        </div>
        </div>

Controller:-  

List<CloudbyzITPM__Task__c> taskname =  [SELECT Id,Name, CloudbyzITPM__Status__c FROM  CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];
    
   public List<CloudbyzITPM__Task__c> gettaskname(){

if(taskname.size() < 3 ){
     for(integer i = 0; i <= (3 - taskname.size());){
         
          taskname.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
     }
     
 }
   return taskname;
 }  

 public void gettaskinprogress(){
        if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
               ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
               ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
                ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
                 {
                  ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
                                      'Insufficient access'));
                 return;
                 }
       if(currentProjectId!=null)
       currentProjectId=string.escapeSingleQuotes(currentProjectId);
       lstoftasksPrg =  [SELECT Id,Name, CloudbyzITPM__Status__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Actual_End_Date__c FROM  CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'In Progress' and CloudbyzITPM__Project__r.Id =: recordId];   

    } 
public List<CloudbyzITPM__Task__c> getlstoftasksPrg(){
    
    return lstoftasksPrg;
}   

  public pagereference redirecttoprjtskprj(){
        return new pagereference('/apex/projecttaskprogress?id='+currentProjectId);
    }




/* task in completed 
  List<CloudbyzITPM__Task__c> taskComp =  [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM  CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
 and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
 
 public list<CloudbyzITPM__Task__c> getRows()
 {   
 List<CloudbyzITPM__Task__c> rows =  [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c, CloudbyzITPM__Status__c FROM  CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
 and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId ];
 
 system.debug('@@ rows of task' + rows);
 List<CloudbyzITPM__Task__c> rows_temp = new List<CloudbyzITPM__Task__c>(rows);
 rows.clear();
 for(CloudbyzITPM__Task__c irrTask : rows_temp)
 {
     
 if(irrTask.Name.length()>10) 
 { 
     system.debug('@@ rows of task' + rows);
      irrTask.Name = irrTask.Name.substring(0,10) + '...' ; 
 } 
 rows.add(irrTask);       
 
 } 
(rows.size() < 3 ){
     for(integer i = 0; i <= (3 - rows.size());){
         rows.add(new CloudbyzITPM__Task__c(Name = 'N/A'));
     }
 }
    return rows;  
 }
public void gettaskcompleted(){
    System.debug('@@lstoftaskscmp@@');
        if (!Schema.sObjectType.CloudbyzITPM__Task__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.id.isAccessible()
               ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.name.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Milestone__c.isAccessible()
               ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_Start_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Planned_End_Date__c.isAccessible()
                ||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_End_Date__c.isAccessible()||!Schema.sObjectType.CloudbyzITPM__Task__c.fields.CloudbyzITPM__Actual_Start_date__c.isAccessible())
              {
                 
                 ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
                                      'Insufficient access'));
                 return;
                 }
                 System.debug('@@currentProjectId@@'+currentProjectId);
    
       if(currentProjectId!=null)
       currentProjectId=string.escapeSingleQuotes(currentProjectId);
       lstoftaskscmp =   [SELECT Id,Name, CloudbyzITPM__Actual_End_Date__c,CloudbyzITPM__Milestone__c,CloudbyzITPM__Planned_Start_Date__c,CloudbyzITPM__Planned_End_Date__c ,CloudbyzITPM__Actual_Start_date__c,CloudbyzITPM__Status__c FROM  CloudbyzITPM__Task__c WHERE CloudbyzITPM__Status__c = : 'Completed' and CloudbyzITPM__Actual_End_Date__c >=:system.today().toStartOfWeek().addDays(-7)
 and CloudbyzITPM__Actual_End_Date__c <=:system.today().toStartOfWeek().addDays(-1) and CloudbyzITPM__Project__r.Id =: recordId];
    
    } 
public List<CloudbyzITPM__Task__c> getlstoftaskscmp()
{
    System.debug('@@lstoftaskscmp@@'+lstoftaskscmp);
    return lstoftaskscmp;
}   

  public pagereference redirecttoprjtskcom()
  {
        return new pagereference('/apex/projecttaskcomplete?id='+currentProjectId);
    }


   
Andrew EchevarriaAndrew Echevarria
Hello,

Please be sure to paste your code in code formatting (you can select it from the toolbar) in the future so it's easier to read. 

Can you add oncomplete="alert('test');" to your commandbutton? I'd like to see if it is the client or server side.

Also, try:
public pagereference redirecttoprjtskcom()
  {
// Change first line below to page name if it is not what I put in
        PageReference pr = new pagereference('Page.projecttaskcomplete');
        pr.getParameters().put('id', currentProjectId);
        return pr;
    }

 
Deepak Sharma 184Deepak Sharma 184
HI Andrew,

Thanks For helping me.

I have included the code in my controller and in my VF Page, but it is not working yet.

Below is the screenshot attached. 

User-added image

In this 'Task Completed Last Week' is showing the records in UI. But when i click on the more button, its not working. but others are working. 

Thanks & Regards,

Deepak