+ Start a Discussion
kkr.devkkr.dev 

call apex from list button

Hi All,

 

 Do you have any example of calling apex from list button?

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Starz26Starz26
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}


var status = sforce.apex.execute("CLASSNAME","METHODNAME",{PARAMATERNAME: PARAMETERVALUE});

 

All Answers

Starz26Starz26
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}


var status = sforce.apex.execute("CLASSNAME","METHODNAME",{PARAMATERNAME: PARAMETERVALUE});

 

This was selected as the best answer
Alex.AcostaAlex.Acosta

Another option can be running code off an apex page... ie: List button points to a VF page '/apex/customApexPage'

If your constructor does not support functionality you may need such as making an outbound call, you can always initate another action on your page tag called action to run another method after your constructor. Lastly you can always redirect the user back to the original record or any other place you like within your controller.

kkr.devkkr.dev

Thanks Starz26