Email PDF for Multicompany?

Application Error

Exception caught in: Epicor.ServiceModel

Error Detail

Message: Unable to cast object of type ‘System.DBNull’ to type ‘System.Byte[]’.
Program: Epicor.ServiceModel.dll
Method: ShouldRethrowNonRetryableException

Client Stack Trace

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
at Ice.Proxy.BO.ReportMonitorImpl.GetReportBytes(Guid sysRowId)
at Script.EmailInvc(Int32 InvoiceNum, String Email, String PONumber)
at Script.btnEmailPDF_Click(Object sender, EventArgs args)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Ice.Lib.Framework.EpiButton.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs e)
at Ice.Lib.Framework.EpiButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The error is cause from the line after the messagebox?

ReportMonitorDataSet rmDS = rptMonitor.GetRowsKeepIdleTime(“RptNote=’” + note + “’”, 0, 0, out morePages);
MessageBox.Show (“Line # 143”);
byte[] arr = rptMonitor.GetReportBytes(rmDS.SysRptLst[0].SysRowID);

Hello, Dave. I’m not sure there’s enough information in this question. Are you writing code in a BPM or a customization? In which method or form are you writing this?


The Customization is in the A/R invoice Entry where we added a button and then we fire the code. It works in our non multi-company instance but not in the new pilot multi-company.

Okay, this makes sense. Can you post the full script? I’m interested in seeing the instantiation of rptMonitor and ARInvRpt objects.

1 Like