You need to sign in to do that
Don't have an account?

Execute action methods from VF page witout using a button or link
We have a situation where we need to execute multiple apex classes based on the current record id using a custom button on the detail page layout.
these actions will have DML statements with heavy calcuations and updates on multiple objects
We do not want to take any user inputs or an intermediate button clicks. We just want the user to click on the custom button, then this page should execute the apex classes and redirect back to the records detail page.
Please let me know any ideas and if possible some exeample codes.
Thanks
You can do that, but do be mindful that it violates Security Review best practices (performing a DML without confirming the action). It looks like this:
If "doaction()" returns a pagereference, it will redirect to that pagereference's url. You can use this to return to your original page.