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.