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
Ashutosh Tripathi 9Ashutosh Tripathi 9 

Basic: Calling a controller method on page load ?

I am trying to call a class method on the pasge load, I am not sure how can I do this.
Another one Can I pass the soql query on the page load ?
David ZhuDavid Zhu
You can use Action attribuete in Apex:page component.
<apex:page controller = "mycontroller" action = "{!mypageloadingmethod}">

if using url to pass soql query, you can use the following example in the method (which Action attribute binds to).

your url would be like:
https://xxxx.salesforce.com//?userid=005G0000004H9LY

the apex code would be like:
     string userId = ApexPages.CurrentPage().getParameters().get('userId');

Hope this helps.