Activity Forums Salesforce® Discussions How can I stop actionpoller action after two consecutive runs?

  • Abhinav

    Member
    June 2, 2016 at 12:36 pm

    Hi Himanshu,

    Please use the below snippet.

    <apex:page controller="componentPoller">
    <apex:form >
    <apex:actionPoller action="{!increment}" rerender="count" interval="5" enabled="{!IF(count = 2,false,true)}"/>

    <apex:outputPanel id="count">
    {!IF(count = 2,false,true)}
    {!count}
    </apex:outputPanel>
    </apex:form>
    </apex:page>

    Controller :-

    public class componentPoller{

    public Decimal count {get; set;}

    public componentPoller(){
    count = 0;
    }

    public void increment(){
    count++;
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos