Page 1 of 1

Email Attachments

PostPosted: Thu Jun 09, 2016 3:13 pm
by Nina Tulic
Hi Guys,

I have a client that would like their T&C's to go out as a separate PDF attachment when emailing out their quotes. Do you have an example of how this can be done? I have searched through the forum but have not been able to find any related topics.

Thanks
Nina

Re: Email Attachments

PostPosted: Fri Jun 10, 2016 12:12 pm
by Scott.Pearce
I can't find anything in our library here, so I'd have to say no, we don't. Off the top of my head you should be able to hook into the JiwaFinancials.Jiwa.JiwaApplication.JiwaEmail.EmailMessage.SaveStart event, examine the emailMessageObject.Status, emailMessageObject.OriginalStatus, and emailMessageObject.SourceForm values, and based on those add your .pdf file to the emailMessageObject.Attachments collection.

Re: Email Attachments

PostPosted: Tue Jun 14, 2016 3:51 pm
by Nina Tulic
Hi Scott,

I'm sorry but my technical understanding is quite basic. Are you able to elaborate on your answer or provide an example of what you have described?

Thanks
Nina

Re: Email Attachments

PostPosted: Tue Jun 14, 2016 7:36 pm
by Mike.Sheen
Nina Tulic wrote: or provide an example of what you have described?


In order to do so, we'd pretty much have to provide a plugin which will fulfil your requirements, which would be a couple of hours of work in development and testing - and we can't do that for free.

If you contact [email protected] with a request for a quote, that will get the process started.

Mike

Re: Email Attachments

PostPosted: Wed Jun 15, 2016 10:17 am
by Nina Tulic
Hi Mike,

This is something that we would prefer to do ourselves so that we can start building our knowledge in terms of Jiwa plugins. We understand that we need to modify the Sales Quote Custom Email plugin but we are unclear as to how to do this given the information provided by Scott. Are you able to give us a starting point.

Thanks
Nina

Re: Email Attachments  Topic is solved

PostPosted: Wed Jun 15, 2016 8:01 pm
by Mike.Sheen
Ok, so inside the Sales Quote Custom Email plugin there is a line of code (line 75):

Code: Select all
salesQuoteForm.SalesQuote.Email(emailReportDialog.SelectedReport, emailReportDialog.NameToGiveAttachment, emailReportDialog.From, emailReportDialog.EmailTo, emailReportDialog.RequestReadReceipt, emailReportDialog.Subject, emailReportDialog.CC, emailReportDialog.BCC, emailReportDialog.Message, ExportFormatType)


That is a method provided for convenience which performs the following:
  • Generates a report and saves as PDF to a temporary file location
  • Creates a new email message
  • Attaches the temporary PDF to the email
  • Saves/Sends the email
  • Adds to the email log of the quote the email
  • Saves the quote

What you need to do is right before that call to salesQuoteForm.SalesQuote.Email, you add a handler for the AfterBusinessLogicSetup of the JiwaApplication.Manager instance - and in that handler, check that an email type business logic is being created, if so then add a handler there for the Email's SaveStart event - and in that handler add your additional attachment to the email, then remove your handler for the SaveStart event, and then after the call to salesQuoteForm.SalesQuote.Email remove your handler for the AfterBusinessLogicSetup event of JiwaApplication.Manager.