Email Report as attachment & Add another attachment

We are using Ax 2012 R3.

We are sending Sales Order Confirmation in Email as attachment.

We require to send another PDF along with this report in the same email.

How can this be done?

What is another PDF document is this generated from AX or it’s from external sources.

it is external resource. We need to attach terms & conditions for the customers along with the sales confirmation report.

I think we need to do a customization on this regard. Since there is no option available to attach external source document for auto generated emails.

We have a customized code to generate the emails for report.Below is the code. Can you help modify the code to add another attachment to the report? Or provide another way through which we can achieve this?

SalesFormletter =
SalesFormletter::construct(DocumentStatus::Confirmation);

SalesTable.clear();

SalesTable = SalesTable::find(_salesId);
//SalesFormletter.update(SalesTable,
//systemDateGet(),
//SalesUpdate::All,
//AccountOrder::None,
//false,
//false);

if(SalesTable)
{
SalesFormletter.update(SalesTable,
systemDateGet(),
SalesUpdate::All,
AccountOrder::None,
false,
false);
}

controller = new SrsReportRunController();

//set report name
controller.parmReportName(ssrsReportStr(SalesConfirm, Report));

contract = controller.ParmReportContract().parmRdpContract() as SalesConfirmContract;

contract.parmRecordId(custConfirmJour.RecId);

//create email contract
emailContract = new SrsReportEMailDataContract();

//fill in the email contract details
emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
emailContract.parmSubject(“Nidec Sales Confirmation Report”);
emailContract.parmTo(_email);
emailContract.parmCc(sysUserInfo.Email);

// get print settings from contract
printSettings = controller.parmReportContract().parmPrintSettings();

//update print settings with email contract and use pdf format in the attachment
printSettings.printMediumType(SRSPrintMediumType::Email);
printSettings.parmEMailContract(emailContract);
printSettings.fileFormat(SRSReportFileFormat::PDF);

// suppress the parameter dialog
controller.parmShowDialog(false);

// start operation
controller.startOperation();

Sorry, I am not a technical person.

I have some knowledge and experience with sending emails with attachments to customers/vendors. Hence I was trying to help you out.

Hello Krupa,

I have the similar requirement as yours.
Did you find the solution ?

Krupa & Manjulac, have you traced your code to srsreportrunmailer which uses mailer or inetmailer, both have a parameter named attachment path. This parameter is a comma delimited parameter which normally you only send 1 attachment but could be used to send additional. I would have to review the project I did long ago but I know I loaded this parameter with multiple attachments.

Hello Randy,
I have used the delimiter and i am able to add another attachment. I am trying to add terms and conditions as an attachment ,for that I am creating a temporary path using WINAPI::getTempPath() ,creating a new PDF file and trying to write the HTML template into it . I am not able to do so .Getting syntax error .
Any suggestions please ?

I am trying to add more report attachment but not able to do this, can you please send me code for more report attachment.