1

from visual flow i am calling apex class, while calling I need to pass 5 param(3 List, 2 String).but it is not accepting more than 1 param @Invocalble method how to solve this

public class SendMail
{   
    @InvocableMethod
    public static void SendMailMethod(List<Id> ConDocIDs,String tosub,string messageBody,List<string> sendTo,List<string> bccAddresses,List<string> ccAddresses)
    {      

                List<Messaging.EmailFileAttachment> attachments = new List<Messaging.EmailFileAttachment>{};
                List<ContentVersion> Contentversionlist = [select id,VersionData,PathOnClient,ContentDocumentId from ContentVersion where ContentDocumentId IN:ConDocIDs ];

                Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage(); 

                for (ContentVersion document: Contentversionlist)
                {
                    Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
                    attachment.setBody(document.VersionData); 
                    attachment.setFileName(document.PathOnClient);
                    attachments.add(attachment);
                }

                semail.setSubject(tosub);
                semail.setToAddresses(sendTo);
                system.debug(semail);
                semail.setHtmlBody(messageBody); 
                semail.setFileAttachments(attachments);

                myListofMails.add(semail);


                    System.debug('myListofMails'+ myListofMails.size());
                    if(myListofMails.size()>0) 
                    {
                        try {
                            Messaging.reserveSingleEmailCapacity(myListofMails.size());
                            Messaging.sendEmail(myListofMails);
                            System.debug('Your done! Mail sent successfully');
                        } catch (Exception e) {
                            System.debug('You have used up your daily allowance of mails');
                        }
                    }
    }               
}

Am getting this error:

Error: Compile Error: Only one parameter is supported on methods with @Invocable annotation at line 4 column 2

  • How are you getting those 3 parameters in the flow? Can you explain a bit on that part? – codeyinthecloud Oct 16 '18 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.