You have to run them, and email them yourself.
Here is an example.
This uses the Email Library I made which is available here, which just makes handling the attachments slightly easier. You don’t have to use the library, just go look at it so you can see how attachments work.
Email Library
In this example, I just ran the same type of report twice, instead of running some other type of report.
//using Erp.Tablesets;
//using Newtonsoft.Json;
//ref: Assembly -> Newtonsoft.Json
//ref: Libraries -> EmailLibrary
//ref: Services -> ERP.Rpt.SalesOrderAck
//ref: Tables -> ICE.SysRptLst (Read Only)
//ref: Tables -> ICE.SysTask (Read Only)
Func<int, byte[]> GetASalesOrderPDF = (salesOrderNum) =>
{
byte[] reportPDF = null;
CallService<Erp.Contracts.SalesOrderAckSvcContract>(soa =>
{
string taskNote = Guid.NewGuid().ToString(); //Magic
SalesOrderAckTableset salesOrderAckTS = soa.GetNewParameters();
SalesOrderAckParamRow paramRow = salesOrderAckTS.SalesOrderAckParam.First();
paramRow.OrderNum = salesOrderNum;
paramRow.AgentID = "SystemTaskAgent";
paramRow.AutoAction = "SSRSGENERATE";
paramRow.ReportStyleNum = 2;
paramRow.TaskNote = taskNote;
soa.RunDirect(salesOrderAckTS);
reportPDF = (from sysRpt in Db.SysRptLst
join sysTask in Db.SysTask on
new {sysRpt.Company, sysRpt.SysTaskNum} equals
new {sysTask.Company, sysTask.SysTaskNum}
where
sysTask.TaskNote == taskNote
select
sysRpt.RptData).FirstOrDefault();
});
return reportPDF;
};
Dictionary<string, byte[]> dicReports = new Dictionary<string, byte[]>();
int salesOrder1 = 263482;
int salesOrder2 = 263485;
dicReports.Add($"Report_{salesOrder1}.pdf", GetASalesOrderPDF(salesOrder1));
dicReports.Add($"Report_{salesOrder2}.pdf", GetASalesOrderPDF(salesOrder2));
string jsonDicReports = JsonConvert.SerializeObject(dicReports);
string fromEmail = "noreply@nope.com";
string toEmail = "me@nope.com";
this.EfxLib.EmailLibrary.Email(fromEmail, toEmail, "Test 2 Report Attachments", "Hello, here are two reports", jsonDicReports, false, false, "", "", "", "", "");
Edit: BTW, I’m working on a library now to make a lot of this easier.