Add another attachment to sales order email

Posted:
Thu Jul 16, 2020 1:38 pm
by SBarnes
The line below will email a sales orders as a pdf, I want to add a second attachment namely a specific csv of the order is there a way to do this?
- Code: Select all
salesOrder.Email(report,attachmentName, "EmailFromHere",EmailTo,false, subject,"","",message,CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Re: Add another attachment to sales order email 

Posted:
Thu Jul 16, 2020 5:19 pm
by Mike.Sheen
That method, Email, from the sales order class ultimately results in a JiwaApplication.JiwaEmail.EmailMessage being created via the business logic factory, and then a Save() of that being invoked.
So, in order to add more documents to the Attachments collection, you would need to add a handler for the SaveStart of the JiwaApplication.JiwaEmail.EmailMessage object before the salesOrder.Email() method is invoked.
On the surface it seems it should be easy enough - let us know if you can't get that to work and I can try to work it out myself.
Re: Add another attachment to sales order email

Posted:
Thu Jul 16, 2020 5:43 pm
by SBarnes
Hi Mike,
Ok thanks I would assume source type will tell me its the sales order and Source ID will be the InvoiceID?