• Sachin Gahlot
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
When I click on cancel button, what should happen is firstly it hsould update the list with vf page and then it should load the new page through pagr Reference. What's wrong here?

Code -
Controller -

public PageReference getBack(){
         system.debug('timeZoneWrapperBackupList :'+timeZoneWrapperBackupList);
         if(!timeZoneWrapperBackupList.isEmpty() && timeZoneWrapperBackupList.size()>0){
            timeZoneWrapperList = timeZoneWrapperBackupList.clone(); // sachin - INC6670357   
         }  
         system.debug('timeZoneWrapperList :'+timeZoneWrapperList);
         String dateIdParam = ApexPages.currentPage().getParameters().get('schDateId');
         String timeIdParam = ApexPages.currentPage().getParameters().get('schTimeId');
         PageReference nextPage;
         if(dateIdParam !=null){
            nextPage = new PageReference('/' + dateIdParam);
         } else if (timeIdParam !=null){
            nextPage = new PageReference('/' + timeIdParam);
         } else if (programSch.Id !=null){
            nextPage = new PageReference('/' + programSch.Id);
         } else {
            Schema.DescribeSObjectResult result = Program_Schedule__c.SObjectType.getDescribe();
            nextPage = new PageReference('/'+ result.getKeyPrefix()+'/o');
         }
         return nextPage;
     }

vf page -

         <apex:commandbutton value="Cancel" onclick="return confirm('Are you sure you want to cancel?');" action="{!getBack}" rerender = "timezoneId"/>
When I click on cancel button, what should happen is firstly it hsould update the list with vf page and then it should load the new page through pagr Reference. What's wrong here?

Code -
Controller -

public PageReference getBack(){
         system.debug('timeZoneWrapperBackupList :'+timeZoneWrapperBackupList);
         if(!timeZoneWrapperBackupList.isEmpty() && timeZoneWrapperBackupList.size()>0){
            timeZoneWrapperList = timeZoneWrapperBackupList.clone(); // sachin - INC6670357   
         }  
         system.debug('timeZoneWrapperList :'+timeZoneWrapperList);
         String dateIdParam = ApexPages.currentPage().getParameters().get('schDateId');
         String timeIdParam = ApexPages.currentPage().getParameters().get('schTimeId');
         PageReference nextPage;
         if(dateIdParam !=null){
            nextPage = new PageReference('/' + dateIdParam);
         } else if (timeIdParam !=null){
            nextPage = new PageReference('/' + timeIdParam);
         } else if (programSch.Id !=null){
            nextPage = new PageReference('/' + programSch.Id);
         } else {
            Schema.DescribeSObjectResult result = Program_Schedule__c.SObjectType.getDescribe();
            nextPage = new PageReference('/'+ result.getKeyPrefix()+'/o');
         }
         return nextPage;
     }

vf page -

         <apex:commandbutton value="Cancel" onclick="return confirm('Are you sure you want to cancel?');" action="{!getBack}" rerender = "timezoneId"/>
Hello,

I have a trigger, which has future method in it.
This future method updates the fields or the trigger object.

I want to implement something which will refresh the part of the page , after the end of future method.

 
  • December 01, 2015
  • Like
  • 0