In Report Style - Breaking & Routing is it possible to include any attachments associated with a PO? Or is this only possible if we have the ECM/DocStar module?
APR gets you the Routing and Breaking, ECM gets you the ability to manipulate attachments stored in ECM, but there are no widgets/methods in APR to deal with the other document storage types.
See the Epicor Idea Add APR widget to print attachments like "Take | Epicor Kinetic Ideas (aha.io) and add your vote!!
The alternative would be to build your own BPM or Function that takes advantage of the attachment business logic and do it all yourself. There are a number of threads here that deal with Attachment custom code.
Thanks Mike, my vote has been duly added!
I’ll check out the attachment custom code threads now.
I don’t see any way to call custom code or functions in Report Style, Breaking/Routing, so I’m not sure I can do this.
the custom solution would not be in APR, but directly in a UI customization, Function, or BPM.
We used a snippet of code to achieve this:
// Invoke the drawings service to find the attaced drawings
var svcDrg = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.DrawingsSvcContract>(this.Db);
if (svcDrg != null)
{
string whereClauseDrawings = "Key1 = '" + row.JobNum + "' AND RelatedToFile = 'JobHead'";
bool drgPgs;
var dsDrg = svcDrg.GetRows(whereClauseDrawings, 10, 0, out drgPgs);
if (dsDrg.Drawings.Count > 0)
{
foreach (var dwg in dsDrg.Drawings.Where(a => a.DocTypeID == "DRAW"))
{
try
{
var filename = dwg.FileName;
byte[] fileContents = File.ReadAllBytes(filename);
var stream = new MemoryStream(fileContents);
stream.Position = 0;
attachments.Add(dwg.DrawDesc,stream);
}
catch (Exception ex)
{
throw new BLException(ex.Message);
}
}
}
// Set up mailing service
using (Ice.Mail.SmtpMailer mailer = new Ice.Mail.SmtpMailer(this.Session))
{
var message = new Ice.Mail.SmtpMail();
message.SetFrom("epicor@progressive-technology.co.uk");
message.SetTo(EmailTO);
message.SetCC(EmailCC);
message.SetBcc(EmailBCC);
message.SetSubject(EmailSubject);
message.SetBody(EmailBody);
message.IsBodyHtml = true;
//Send
mailer.Send(message,attachments);
}
}
}