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
sfdc freshersfdc fresher 

how to insert a record when the vf page is loaded

hi everyone,
could anyone please explain me how to perform actions like(insert,update etc) when the vf page is loaded.



Thanks
Om PrakashOm Prakash
You can do by using action attribute of apex:page 
Write your logic in method doAction. 
<apex:page action="{!doAction}" controller="ControllerName">
Note - If you are working for app then this is not recommneded in term of security.

DML can be also perform by using JS remoting when page is loaded or you can also call a method by using actionFunction from java script while page is loaded.