Visualforce ActionPoller Component

Visualforce ActionPoller Component  :- In our previous Salesforce Tutorial we have learned about Actionfunction in Salesforce with an example. In this Salesforce developer Training Tutorial we are going to learn about Visualforce Actionpoller component, visualforce actionpoller component with an example.

How  visualforce actionpoller component is used ?

In visualforce, actionpoller component is used to perform long run operations incrementally. This increment can be done by a series of small steps. In Visualforce pages, Actionpoller component is invoked with controller  during constant time intervals to perform long running actions.

Example :- Actionpoller component can be used to refresh database list for every 60 seconds.

Let us see a simple program on visualforce actionpoller component.

Create new visualforce page as shown below.

Visualforce Action Poller Component

Click on Create Page actionpoller link as shown below.

Visualforce Action Poller Component

Visualforce Page :- 

Visualforce Action Poller Component

  • When using action poller component in visualforce page we must provide value for  action attribute ex:- action={!timeTwo}.
  • Action poller component must be written between <apex:form> and </apex:form> tag.
  • If we required to perform long run action in visualforce pages, in action poller component we have to provide a value for interval attribute.

Form this Visualforce action poller component example, multiplication of a number by two can be automatically incremented for every 5 sec. Initially One is multiplied with number two after 5 sec result is multiplied by two and after 5 sec interval of time result is multiplied by two.

Controller :-

Visualforce Action Poller Component

Visualforce Actionpoller Component Output :-

Visualforce ActionPoller Component

After few intervals of time output is as shown below.

Visualforce ActionPoller Component

Leave a Reply