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
shobana shobanashobana shobana 

how to refresh the page through visualforce

Hi everyone
My scenario is to show the open task of lead object as a seperate related list instead of using open activity.
For that i took viusalforce and extension controller.
It works good actually.
when clicking  the close button and check box the particular record will get closed but the thing is 
its not showing in Activity History immediatly after refreshing the page only its shows that particular record in Activity History.
can anyone help me out to solve thing problem..
public class OpenTasks {

    public List<OpenActivity> open{get;set;}

    public Id leadLd{get;set;}
    public list<wrapperclass> listwrapper{get;set;}

    public OpenTasks(ApexPages.StandardController controller){

        leadLd = ApexPages.CurrentPage().getparameters().get('id');
        list<task> open1 =new list<Task>();

        listwrapper = new list<wrapperclass>();

        list<lead>   le =[SELECT Name, (Select Id,Subject, WhoId, ActivityDate,Status, Priority, OwnerId FROM Tasks WHERE IsClosed=false)

                            FROM Lead WHERE Id = :leadld];

            for(Task k: le[0].Tasks)


               listwrapper.add(new Wrapperclass(k));




    public class wrapperclass

        public  boolean checked{get;set;}

        public Task k{get;set;}

        public Wrapperclass(Task k){




  public PageReference close()


        list<Task> listofopen=new list<Task>();


            for(Integer i=0; i<listwrapper.size();i++)

                wrapperclass w = listwrapper[i];




            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Select atleast one column '));



           update listofopen;   

      return null;




<apex:page standardController="Lead" extensions="OpenTasks"  >

    <apex:form >

        <apex:pageBlock title="Open Tasks" mode="edit" id="opnTsks">

            <apex:Messages />        

            <center><a href="{!leadld}&retURL={!leadld}" target="_top"><button type="button">New Task</button></a>

                <apex:commandButton value="close" action="{!close}" rerender="opnTsks" />


            <apex:pageBlockTable value="{!listwrapper}" var="each" >

                <apex:column headerValue="Action">

                     <apex:inputCheckbox value="{!each.checked}"/>


                    <apex:outputlink value="/{!}/e?retURL={!each.k.WhoId}" target="_top"> Edit </apex:outputlink>


                <apex:column headerValue="Subject" value="{!each.k.Subject}"/>

                <apex:column headerValue="ActiveDate" value="{!each.k.ActivityDate}"/>

                <apex:column headerValue="Status" value="{!each.k.Status}"/>




Thank you in advance...
Best Answer chosen by shobana shobana
Bhanu MaheshBhanu Mahesh
Hi Shobana,

Refer the below link it may help you

Bhanu Mahesh

All Answers

Bhanu MaheshBhanu Mahesh
Hi Shobana,

Refer the below link it may help you

Bhanu Mahesh
This was selected as the best answer
shobana shobanashobana shobana
Hi Bhanu Mahesh
Thank you for helping me.Its working good.