I have a public emailing apex class I need to call that from onclick javascript button of a detail page. Can someone let me know , if I can do that? Please give me an example. I am not getting it.
I have a global webservice method that receives List of an Sobject record.
Apex webservice method
webservice static void sendMails(List<Form_Requests_abv__c> newrequests)
{
Set<Id> formIds = new Set<Id>();
for (Form_Requests_abv__c fr : newrequests)
{
formIds.add(fr.id);
}
List<String> sendtoemail = new List<String>();
List<ABV_Form_Request_abv__c> Useremails= ABV_Form_Request_abv__c.getAll().values();
if(!Useremails.isEmpty()){
for(ABV_Form_Request_abv__c Useremail : Useremails)
{
if(String.isnotBlank(Useremail.Email_abv__c)){
...............
How can I pass value there?
My javascript code
var leadIds = {!GETRECORDIDS($ObjectType.Form_Requests_abv__c)};
sforce.apex.execute("MailerUtils","sendMails",{newrequests: leadIds});
window.location.reload();
<apex:actionFunction>