You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Put Apex Execute command into button
Hello, I use a command in Apex execute from workbench to create xlsx.
The command in the xlsx is:
The command in the xlsx is:
XLSXGenerator.generate(new List<String>{'Apex', 'Create', 'XLSX', 'By Raymar'})I would like to execute the command with a button from account object. could you tell me if it is possible and how I can do it?
Can you please check the below method
Now create a custom button:
Goto --> Setup --> Object --> Buttons, links and Actions section-->Click New Button or Link.
Enter the Name of the button
Behaviour : Execute Javascript
Content source : On-Click Javascript
use below JS:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
if({!Account__c.Name}!=Null)
{
sforce.apex.execute("SampleClass","sampleMethod",{}"});
alert("This is {!Account__c.Name}");
}
Hope this is helpful!
Regards,
Ranjan