+ Start a Discussion
sri srisri sri 

Is there any alternative for Action Poller?

Hi

 

To invoke action method we generally use Action Poller. 

 

Is there any alternative for this. Thank you

Rahul SharmaRahul Sharma
Is there any specific need to net use Action poller?
hitesh90hitesh90

Yes,

 

Using Javascript we can invoke apex controller action in specified Interval.

 

example:-

 

 

<script language="javascript">
     var int=self.setInterval(function(){callActionFunction()},10000);
     function callActionFunction(){
          ActionFunctionName();
      }
</script>

Note:-  Mark this as a Solution if it is useful.

sri srisri sri

thank you

 

Can you explain this code lill bit

hitesh90hitesh90

whenever visualforce page is loaded this javascript will execute in every 10 sec.

so it's call apex action function in every 10 second.

 

here is the full code.

 

<apex:page >
    <script language="javascript">
        var int=self.setInterval(function(){callActionFunction()},10000);
        function callActionFunction(){
            ActionFunctionName();
        }
    </script>
    <apex:actionFunction action="{!ControllerAction}" name="ActionFunctionName"/>
</apex:page>

 

Note:-  Mark this as a Solution if it is useful.

 

Thanks,

hitesh Patel

imAkashGargimAkashGarg

the minimum interval for Action poller is 5 sec, any other option if less than 5 sec interval is required?

Rahul ChowdaryRahul Chowdary
Hi,

try to use streaming Api it is better than action poller..

Thanks
rahul