Activity Forums Salesforce® Discussions Salesforce VIsualForce Pages - count number of times a page is loaded

  • Subramanyam R

    Member
    June 7, 2017 at 3:43 am

    use action pollar in the page... use temporary variable in the apexcode of type integer and call the apex method ....using action pollar

  • S

    Member
    June 7, 2017 at 4:06 am

    Hi Harshita,

    If you want to count the number of times a page is loaded. You can write an action attribute on Apex:page and invoke a controller method from it. Once invoked, you can write the logic which will update the counter by 1 in your controller.

    You might think - Why Constructor is not used here - because DML operations are not allowed within a constructor..

    Why Action Poller is not used - because that invokes itself after some designated time and might not happen immediately on page load.

    Hope this helps ! Let me know your concerns or doubts.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos