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
Ashritha ReddyAshritha Reddy 

hii pls answer me

can any one give me the realtime scenarios for action poller and action region please?
Best Answer chosen by Ashritha Reddy
JyothsnaJyothsna (Salesforce Developers) 
Hi Ashritha Reddy,

Please check the below sample code for action poller and action region.
Action Poller Example:

VisualForce page:
 
<apex:page controller="ActionpollarClass">
 <apex:form >
 <apex:pageBlock id="payment">

 <apex:actionPoller action="{!movepayment}" reRender="payment" interval="5" status="status" enabled="{!paymentstate!='complete'}"/>
 <apex:outputPanel id="payment">
 The state of your payment mode is 
 <apex:outputText style="font-weight:bold" value="{!paymentstate}">
 </apex:outputText>
 </apex:outputPanel>
 <br/>
 <apex:actionStatus startText="pooling..." id="status"></apex:actionStatus>
 </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:
 
public with sharing class ActionpollarClass {

    public String complete { get; set; }
    public list<string> states=new list<string>{'Connecting to bank','Authorising','Authotized','complete'};
//index of the currentstate
 private integer stateIdx=0;
//getter to reterive the current state
    public String getPaymentstate() {
        return states[stateIdx];
    }

//action method invoked by the pooer increments the current state index
    public PageReference movepayment() {
    stateIdx++;
        return null;
    }

}

Action Region Example:

Please refer the below link for example of  "Action region"

http://www.sfdcpoint.com/salesforce/actionregion-visualforce-salesforce/


Hope this helps you!
Best Regards,
Jyothsna

All Answers

Nagendra ChinchinadaNagendra Chinchinada
Here are resoure with good examples, when to use, description.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionRegion.htm
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionPoller.htm

http://www.cloudforce4u.com/2013/06/difference-between-action-support-and.html

http://sfdcsrini.blogspot.com/2014/07/visualforce-action-region-example.html
http://www.sfdcpoint.com/salesforce/actionpoller-visualforce-salesforce/
JyothsnaJyothsna (Salesforce Developers) 
Hi Ashritha Reddy,

Please check the below sample code for action poller and action region.
Action Poller Example:

VisualForce page:
 
<apex:page controller="ActionpollarClass">
 <apex:form >
 <apex:pageBlock id="payment">

 <apex:actionPoller action="{!movepayment}" reRender="payment" interval="5" status="status" enabled="{!paymentstate!='complete'}"/>
 <apex:outputPanel id="payment">
 The state of your payment mode is 
 <apex:outputText style="font-weight:bold" value="{!paymentstate}">
 </apex:outputText>
 </apex:outputPanel>
 <br/>
 <apex:actionStatus startText="pooling..." id="status"></apex:actionStatus>
 </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:
 
public with sharing class ActionpollarClass {

    public String complete { get; set; }
    public list<string> states=new list<string>{'Connecting to bank','Authorising','Authotized','complete'};
//index of the currentstate
 private integer stateIdx=0;
//getter to reterive the current state
    public String getPaymentstate() {
        return states[stateIdx];
    }

//action method invoked by the pooer increments the current state index
    public PageReference movepayment() {
    stateIdx++;
        return null;
    }

}

Action Region Example:

Please refer the below link for example of  "Action region"

http://www.sfdcpoint.com/salesforce/actionregion-visualforce-salesforce/


Hope this helps you!
Best Regards,
Jyothsna
This was selected as the best answer
Ashritha ReddyAshritha Reddy
Hii thanq can i get any real time examles please @Jyothsna