+ Start a Discussion
Praveen Kumar 212Praveen Kumar 212 

Action Poller Issue

Hi All,

I am working on this Action Poller thing. My requirement is VF component has to change according to the field change or DML operation on a Record in an object. Like the stages are "Processing" "Completed" "Exception". Each Stages have their own VF components which are rendered accordingly.

But, This actionpoller is not moving to next stage from "Processing" to "Completed" though i made DML changes to record.
Pls help. Below is my code.
PAGE..
<apex:page  showHeader="false" controller="DocumentStatusPoller" >
    <apex:form>
    <apex:actionPoller reRender="Intform,Pendform,Compform,Excepform" action="{!pollermeth}"
                        interval="10"  />
    </apex:form>
    <apex:form id="Intform" rendered="{!Intform}">
        <c:Initiating >
             <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
             <div style="font-size:150%;padding:5px">Processing..</div>
        </c:Initiating>
    </apex:form>
    
    <apex:form id="Pendform" rendered="{!Pendform}">
        <c:Pending >
            <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
             <div style="font-size:150%;padding:5px">Pending..</div>
        </c:Pending>
    </apex:form>
    
    <apex:form id="Compform" rendered="{!Compform}">
        <c:Complete >
            <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
             <div style="font-size:150%;padding:5px">Completed..</div>
        </c:Complete>
    </apex:form>
    
    <apex:form id="Excepform" rendered="{!Excepform}">
        <c:Exception >
            <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
             <div style="font-size:150%;padding:5px">Exception Occured</div>
        </c:Exception>
    </apex:form>
CLASS..
public with sharing class DocumentStatusPoller {
    public Boolean Intform{get; set;}
    public Boolean Pendform{get; set;}
    public Boolean Compform{get; set;}
    public Boolean Excepform{get; set;}
    
    
    
   /* public Boolean IntBlk {get; set;}
    public Boolean ExceptionBlk { get; set;}
    public Boolean CompBlk { get; set; }
    public Boolean PendBlk { get; set; }*/
    
    public String DocSessID{get; set;}

    public DocumentStatusPoller(){
    
     DocSessID = ApexPages.currentPage().getParameters().get('DocSessionID');
        
            Intform = true;
            Pendform = false;
            Compform = false;
            Excepform = false;
      
     /* IntBlk = true;
      PendBlk = false;
      CompBlk = false;
      ExceptionBlk = false;*/
      
    }

    public PageReference pollermeth() {
    
   Document_Session__c DocSessRec = [select   Name, 
                                                   Contact_Document__c,
                                                    Exception__c,
                                                    Status__c
                                             from   Document_Session__c where Id='a1JU0000003qSVgMAM'];
    
    if(DocSessRec != null){
        if(DocSessRec.Status__c=='Pending'){
            Intform = false;
            Pendform = true;
            Compform = false;
            Excepform = false;
            
           /* PendBlk = true;
            CompBlk = false;
            ExceptionBlk = false;
            IntBlk = false;*/
        } else
            if(DocSessRec.Status__c=='Complete'){
                
            Intform = false;
            Pendform = false;
            Compform = true;
            Excepform = false;
           /* PendBlk = false;
            CompBlk = true;
            ExceptionBlk = false;  
            IntBlk = false;*/
            
        } else
            if(DocSessRec.Status__c=='Exception'){
              Intform = false;
            Pendform = false;
            Compform = false;
            Excepform = true;
            /*PendBlk = false;
            CompBlk = true;
            ExceptionBlk = false;
            IntBlk = false;*/
          
        }
      }
         return null;
   }
   
 }

 
Best Answer chosen by Praveen Kumar 212
Tejpal KumawatTejpal Kumawat
Hello Praveen,

Can you try with this snippt.
<apex:page  showHeader="false" controller="DocumentStatusPoller" >
    <apex:form>
    <apex:actionPoller reRender="opPanelId" action="{!pollermeth}"
                        interval="10"  />
    </apex:form>
	
	<apex:outputPanel id="opPanelId">
		<apex:form id="Intform" rendered="{!Intform}">
			<c:Initiating >
				 <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Processing..</div>
			</c:Initiating>
		</apex:form>
		
		<apex:form id="Pendform" rendered="{!Pendform}">
			<c:Pending >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Pending..</div>
			</c:Pending>
		</apex:form>
		
		<apex:form id="Compform" rendered="{!Compform}">
			<c:Complete >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Completed..</div>
			</c:Complete>
		</apex:form>
		
		<apex:form id="Excepform" rendered="{!Excepform}">
			<c:Exception >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Exception Occured</div>
			</c:Exception>
		</apex:form>
	</apex:outputPanel>
</apex:page >
Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
 

All Answers

Tejpal KumawatTejpal Kumawat
Hello Praveen,

Can you try with this snippt.
<apex:page  showHeader="false" controller="DocumentStatusPoller" >
    <apex:form>
    <apex:actionPoller reRender="opPanelId" action="{!pollermeth}"
                        interval="10"  />
    </apex:form>
	
	<apex:outputPanel id="opPanelId">
		<apex:form id="Intform" rendered="{!Intform}">
			<c:Initiating >
				 <img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Processing..</div>
			</c:Initiating>
		</apex:form>
		
		<apex:form id="Pendform" rendered="{!Pendform}">
			<c:Pending >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Pending..</div>
			</c:Pending>
		</apex:form>
		
		<apex:form id="Compform" rendered="{!Compform}">
			<c:Complete >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Completed..</div>
			</c:Complete>
		</apex:form>
		
		<apex:form id="Excepform" rendered="{!Excepform}">
			<c:Exception >
				<img src="{!$Resource.SpinnerLightning}" width="50" height="50" />
				 <div style="font-size:150%;padding:5px">Exception Occured</div>
			</c:Exception>
		</apex:form>
	</apex:outputPanel>
</apex:page >
Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
 
This was selected as the best answer
Praveen Kumar 212Praveen Kumar 212
Hey Tejpal Kumawat!. That solved my problem. And I have one more requirement which i am unable to figure out.
"After Complete status is achieved, i want to redirect the current Page to another page." How can i achieve this?.
Kindly Help.