You need to sign in to do that
Don't have an account?
Shekhar Dautpure
Process.Pluginresult
Dear All
We need to create Outlook meeting from Salesforce. I am using flow which will call apex class to create the meeting. I am getting error at one line, and not sure what is wrong
Line which is error is
return new Process.PluginResult(result);
Error message is : Save error: Return value must be of type: Process.Plugin
could you tell me what is going wrong.
We need to create Outlook meeting from Salesforce. I am using flow which will call apex class to create the meeting. I am getting error at one line, and not sure what is wrong
global class SentEmailFlow implements Process.Plugin { String FromAddress; String ToAddresses; String CCAddresses; String Subject; String MessageBody; String MeetingSubject; DateTime StartTime; DateTime EndTime; String Location; String ObjectType; String ObjectId; String[] ToAddressesList; String[] CCAddressesList; Boolean IsMeetingInOutlook = false; //Boolean IsMeetingInSalesforce = false; global Process.Plugin invoke(Process.PluginRequest request) { FromAddress = (String) request.inputParameters.get('FromAddress'); ToAddresses = (String) request.inputParameters.get('ToAddresses'); CCAddresses = (String) request.inputParameters.get('CCAddresses'); MeetingSubject = (String) request.inputParameters.get('Subject'); MessageBody = (String) request.inputParameters.get('MessageBody'); StartTime = (DateTime) request.inputParameters.get('StartTime'); EndTime = (DateTime) request.inputParameters.get('EndTime'); Location = (String) request.inputParameters.get('Location'); ObjectType = (String) request.inputParameters.get('ObjectType'); ObjectId = (String) request.inputParameters.get('ObjectId'); ToAddressesList = new String[] {ToAddresses}; CCAddressesList = new String[] {CCAddresses}; IsMeetingInOutlook = CreateOutlookMeeting(); //IsMeetingInSalesforce = CreateSalesforceMeeting(); Map<String,Object> result = new Map<String,Object>(); result.put('IsMeetingInOutlook', IsMeetingInOutlook); // result.put('IsMeetingInSalesforce', IsMeetingInSalesforce); return new Process.PluginResult(result); } private boolean CreateOutlookMeeting() { boolean IsSuccessfull=false; try { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setToAddresses(ToAddressesList); mail.setCcAddresses(CCAddressesList); mail.setSubject(MeetingSubject); mail.setPlainTextBody(MessageBody); Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment(); attach.filename = 'meeting.ics'; attach.ContentType = 'text/calendar;'; attach.inline = true; attach.body = invite(); mail.setFileAttachments(new Messaging.EmailFileAttachment[] {attach}); Messaging.SendEmailResult[] er = Messaging.sendEmail(new Messaging.Email[] {mail}); IsSuccessfull = true; } catch(exception e) { IsSuccessfull=false; } return IsSuccessfull; } /*private boolean CreateSalesforceMeeting() { boolean IsSuccessfull=false; try { IsSuccessfull=true; } catch(exception e) { } return IsSuccessfull; }*/ private Blob invite() { String txtInvite = ''; txtInvite += 'BEGIN:VCALENDAR\n'; txtInvite += 'PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n'; txtInvite += 'VERSION:2.0\n'; txtInvite += 'METHOD:PUBLISH\n'; txtInvite += 'X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n'; txtInvite += 'BEGIN:VEVENT\n'; txtInvite += 'CLASS:PUBLIC\n'; txtInvite += 'CREATED:20091026T203709Z\n'; txtInvite += 'DTEND:20091028T010000Z\n'; txtInvite += 'DTSTAMP:20091026T203709Z\n'; txtInvite += 'DTSTART:20091028T000000Z\n'; txtInvite += 'LAST-MODIFIED:20091026T203709Z\n'; txtInvite += 'LOCATION:Online\n'; txtInvite += 'PRIORITY:5\n'; txtInvite += 'SEQUENCE:0\n'; txtInvite += 'SUMMARY;'; txtInvite += 'LANGUAGE=en-us:Meeting\n'; txtInvite += 'TRANSP:OPAQUE\n'; txtInvite += 'UID:4036587160834EA4AE7848CBD028D1D200000000000000000000000000000000\n'; txtInvite += 'X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><META NAME="Generator" CONTENT="MS Exchange Server version 08.00.0681.000"><TITLE></TITLE></HEAD><BODY><!-- Converted from text/plain format --></BODY></HTML>\n'; txtInvite += 'X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n'; txtInvite += 'X-MICROSOFT-CDO-IMPORTANCE:1\n'; txtInvite += 'END:VEVENT\n'; txtInvite += 'END:VCALENDAR'; return Blob.valueOf(txtInvite); } global Process.PluginDescribeResult describe() { Process.PluginDescribeResult result = new Process.PluginDescribeResult(); result.Name = 'Meeting Creation'; result.Tag = 'MeetingClasses'; result.inputParameters = new List<Process.PluginDescribeResult.InputParameter> { new Process.PluginDescribeResult.InputParameter('Username', Process.PluginDescribeResult.ParameterType.STRING, true) }; result.outputParameter = new List<Process.PluginDescribeResult.OutputParameter> { new Process.PluginDescribeResult.OutputParameter('IsMeetingInOutlook', Process.PluginDescribeResult.ParameterType.BOOLEAN) }; result.outputParameter = new List<Process.PluginDescribeResult.OutputParameter> { new Process.PluginDescribeResult.OutputParameter('IsMeetingInSalesforce', Process.PluginDescribeResult.ParameterType.BOOLEAN) }; return result; } }
Line which is error is
return new Process.PluginResult(result);
Error message is : Save error: Return value must be of type: Process.Plugin
could you tell me what is going wrong.