I have a custom button on a record page that executes javascript, calls a method1
in a Utilities
class.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var result = sforce.apex.execute("Utilities","Method1",{Id:"{!Account.Id}"});
alert(result);
There is another menthod too in the class (method2
).
Now I want the ability for the user to choose which method to call in the javascript pop-up and then call the appropriate method.
Yes, I tried these
- Visualforce page to redirect from the custom button with selectOptions to choose from and call the appropriate method and it works.
- creating a new picklist field on the object with those options and in javascript checks this picklist value and calls the method. It works too.
But is there a way that I can do completely in the custom button without using extra Visualforce page/fields at all?
Best Answer
Custom buttons support basic javascript. You can use a prompt box to ask for user's input
Hope this helps.