I want to attach files of Sales Orders when sending Email Notification by Business Event
In my case, I want the file HD_VIE also in attachment. I don’t know if it is possible because it seems like we only could attach report in attachment of email.
Please let me know if there is any way to accomplish this requirement in version 2022 R2
I found an similar topic but didn’t get the answer
Attaching files to email notifications using Business Events is currently not natively supported in Acumatica as of my knowledge.
However, you may consider a workaround using Acumatica's customization capabilities:
Customize Email Sending Mechanism: You can customize the email sending mechanism to include attached files from the corresponding sales order record. This would likely involve modifying the graph that sends the emails, to fetch the files attached to the Sales Order and include them in the outgoing email.
publicclass SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
// Event Handler for the 'SendEmail' buttonpublicdelegatevoidSendEmailDelegate(PXCache cache, PX.SM.Email email);
[PXOverride]
publicvoidSendEmail(PXCache cache, PX.SM.Email email, SendEmailDelegate baseMethod)
{
// Invoke the original method
baseMethod?.Invoke(cache, email);
// Get the current SOOrder recordvar soOrder = Base.Document.Current;
if (soOrder != null)
{
// Get all files attached to the SOOrderforeach (PX.SM.UploadFile file in PXNoteAttribute.GetFileNotes(Base.Document.Cache, soOrder))
{
// Attach each file to the email
PX.SM.UploadFileInq.AddFile(email, file);
}
}
}
}
Please note that the above code is not a ready-to-use solution, but rather an illustration of the approach you can take. You might need to adapt it to your specific needs.
Use of Third-Party Tools: You could potentially employ third-party tools like Postman or Zapier to access Acumatica's REST API for gathering attachment files and sending the email.
In either case, given that this is not a standard feature of Acumatica, you might want to reach out to Acumatica support or to an Acumatica customization consultant to assist with this.
Attaching files to email notifications using Business Events is currently not natively supported in Acumatica as of my knowledge.
However, you may consider a workaround using Acumatica's customization capabilities:
Customize Email Sending Mechanism: You can customize the email sending mechanism to include attached files from the corresponding sales order record. This would likely involve modifying the graph that sends the emails, to fetch the files attached to the Sales Order and include them in the outgoing email.
publicclass SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
// Event Handler for the 'SendEmail' buttonpublicdelegatevoidSendEmailDelegate(PXCache cache, PX.SM.Email email);
[PXOverride]
publicvoidSendEmail(PXCache cache, PX.SM.Email email, SendEmailDelegate baseMethod)
{
// Invoke the original method
baseMethod?.Invoke(cache, email);
// Get the current SOOrder recordvar soOrder = Base.Document.Current;
if (soOrder != null)
{
// Get all files attached to the SOOrderforeach (PX.SM.UploadFile file in PXNoteAttribute.GetFileNotes(Base.Document.Cache, soOrder))
{
// Attach each file to the email
PX.SM.UploadFileInq.AddFile(email, file);
}
}
}
}
Please note that the above code is not a ready-to-use solution, but rather an illustration of the approach you can take. You might need to adapt it to your specific needs.
Use of Third-Party Tools: You could potentially employ third-party tools like Postman or Zapier to access Acumatica's REST API for gathering attachment files and sending the email.
In either case, given that this is not a standard feature of Acumatica, you might want to reach out to Acumatica support or to an Acumatica customization consultant to assist with this.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.