Skip to main content
Solved

Including Sales Order attachment when sending Email via Business Event Notification

  • June 22, 2023
  • 1 reply
  • 685 views

Forum|alt.badge.img

Hello colleagues,

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 

 

Thanks for your help

Best answer by davidnavasardyan

Hi @mrthanhkhoi 

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:

  1. 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.
    public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
    {
        // Event Handler for the 'SendEmail' button
        public delegate void SendEmailDelegate(PXCache cache, PX.SM.Email email);
        [PXOverride]
        public void SendEmail(PXCache cache, PX.SM.Email email, SendEmailDelegate baseMethod)
        {
            // Invoke the original method
            baseMethod?.Invoke(cache, email);
    
            // Get the current SOOrder record
            var soOrder = Base.Document.Current;
    
            if (soOrder != null)
            {
                // Get all files attached to the SOOrder
                foreach (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.

  2. 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.
  3. 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.

     

View original
Did this topic help you find an answer to your question?

1 reply

davidnavasardyan
Jr Varsity I
Forum|alt.badge.img+2

Hi @mrthanhkhoi 

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:

  1. 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.
    public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
    {
        // Event Handler for the 'SendEmail' button
        public delegate void SendEmailDelegate(PXCache cache, PX.SM.Email email);
        [PXOverride]
        public void SendEmail(PXCache cache, PX.SM.Email email, SendEmailDelegate baseMethod)
        {
            // Invoke the original method
            baseMethod?.Invoke(cache, email);
    
            // Get the current SOOrder record
            var soOrder = Base.Document.Current;
    
            if (soOrder != null)
            {
                // Get all files attached to the SOOrder
                foreach (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.

  2. 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.
  3. 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.

     


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings