You need to sign in to do that
Don't have an account?
How can I add a button to a visualforce page that executes onclickjavascript?
I have a perfectly working OnClick Javascript button already.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} var scr="batchMaintenanceCalculator c = new batchMaintenanceCalculator (); " + " Database.executeBatch(c, 25); "; var result = sforce.apex.executeAnonymous(scr); alert("Maintenance amounts are being updated for all customers.");I am now trying to relocate the button from my Account List View to the Home Page. I believe the only way moving forward to accomplish this is to have a Visualforce Page with a button that executes the code above. What would the code end up being on the VF page?
http://sfdc.arrowpointe.com/2009/01/08/invoke-apex-from-a-custom-button-using-a-visualforce-page/
Sample code:-
http://salesforce.stackexchange.com/questions/12864/best-practice-for-calling-apex-methods-from-custom-button
CALL APEX CLASS FROM CUSTOM BUTTON (JAVASCRIPT) IN SALESFORCE
http://blog.shivanathd.com/2014/07/call-apex-class-from-custom-button-salesforce.html
Please let us know if this will help you
Thanks
Amit Chaudhary