I’ve managed to get a function to preview a report or to email it.
Is there a way to get it to save the file say to the file share that Epicor gave us? There is a save local method but it was cryptic and I was not able to get it to do anything concrete.
Working code to email customer statement
using (var context = Ice.Services.ContextFactory.CreateContext<ErpContext>())
{
var custStatSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustomerStatementSvcContract>(context);
var ds = custStatSvc.GetNewParameters();
var paramRow = ds.CustomerStatementParam[0]; // Row 0 is parameters, Row 1 is Report Style parameters
paramRow.EndDate = DateTime.Now; // Default today
paramRow.BeginDate = DateTime.Now.AddDays(-30); // Default 30 days ago
paramRow.AgentID = "System Task Agent";
paramRow.ReportStyleNum = 1001;
paramRow.AutoAction = "SSRSPrint"; // "SSRSGenerate"; // "SSRSPreview"; // Generate or Print - Preview opens Excel, Print forces PDF
paramRow.TaskNote = DateTime.Now + " Test";
paramRow.SSRSRenderFormat = "Excel";
paramRow.EMailTo = "you@yourcompany.com";
paramRow.EMailBody = "Customer Statement";
string userID = callContextClient.CurrentUserId;
paramRow.WorkstationID = "web_" + userID;
paramRow.SSRSRenderFormat = "Excel"; // To force render
paramRow.AttachmentType ="Excel"; // To force attachment type
//custStatSvc.SubmitToAgent(ds, "System Task Agent", 0, 0, "Erp.UIRpt.CustStat");
custStatSvc.SubmitToAgent(ds, "SystemTaskAgent", 0, 0, "Erp.UIRpt.CustStat");
}