web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How do I attach files to an email report?

(0) ShareShare
ReportReport
Posted on by

AX version is AX2009  I have looked at several examples and can’t get them to work.

After you print a report to the screen, I press the printer icon. Then change the option to Email.  I need to add one or more attachments with minimal user interface.

What I have got so far.  In the form SysPrintForm a check box to attach documents.  In the CloseOK method I have added the following line before the Super();

sysPrintOptions.attachExtrFiles(clientSysPrintOptions.pack());          // AZ 1367  Attaching files to emails

class SysPrintOptions

// AZ 1367  Attaching files to emails

public void attachExtrFiles(container packedSysPrintForm)

{

   DocuRef                     docuRef;

   CustQuotationJour           CustQuotationJour;

   CustQuotationTrans          CustQuotationTrans;

   SysPrintOptions tmp = SysPrintOptions::create(packedSysPrintForm);

   ;

   if(tmp.enableAttachFiles())

   {

       this.enableAttachFiles(tmp.enableAttachFiles());

       this.parmJournalTable(tmp.parmJournalTable());

       switch (journalTable.TableId)

       {

           case tableNum(CustQuotationJour) :

               CustQuotationJour.data(journalTable);

               while select docuRef

                   where docuRef.RefRecId == CustQuotationJour.RecId

                      && docuRef.RefTableId == CustQuotationJour.TableId

                      && docuRef.TypeId  != 'Note'

                      && docuRef.AKRShowOnSalesQuotation == noYes::Yes

               {

                   printJobSettings.fileName(docuRef.completeFilename());

               }

               while select CustQuotationTrans

                   where CustQuotationTrans.QuotationId    == CustQuotationJour.QuotationId

                      &&  CustQuotationTrans.QuotationDate == CustQuotationJour.QuotationDate

               {

                   while select docuRef

                       where docuRef.RefRecId == CustQuotationTrans.RecId

                          && docuRef.RefTableId == CustQuotationTrans.TableId

                          && docuRef.TypeId  != 'Note'

                          && docuRef.AKRShowOnSalesQuotation == noYes::Yes

                   {

                       printJobSettings.fileName(docuRef.completeFilename());

                   }

               }

               break;

       }

}

No addition files are added to the email.

I appreciate any help with this problem.

Thanks

Abraham Z.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    As per my experience, you cannot handle more than one attachment on standard report email feature.

    I suggest you to evaluate the Dyxon Report Mailer add-on.

    This have many features, above all attach extra documents such as terms & conditions,etc. to every e-mail. Default attachments can be specified per report.

    Look at www.dynamics-ax-addons.com/.../report_mailer.html

    Regards

  • Suggested answer
    Community Member Profile Picture
    on at

    may be you should consider following class and method which basically gets called when a report is sent using email

    Classes\Info\reportSendmail()

    Classes\SysINetMail\sendMailAttach()

    Please explore further if you can utilize this logic to implement your customization.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans