We have a requirement to attach custom report to email as an attachment. As per our requirement we created a process screen for this. Issue we are facing is, when we use below line of code we are getting “OBJECT REFERENCE ERRO”, can you please have a look at below sample code.
public class ProcessReports : PXGraph<ProcessReports>
{
InjectDependency]
protected IReportLoaderService ReportLoader { get; private set; }
}InjectDependency]
protected IReportRenderer ReportRenderer { get; private set; }
public PXCancel<DACName> Cancel;
public PXProcessing<DACName, Where<DACName.DACName, Equal<OPR>>> QueueList;
public ProcessReports()
{
QueueList.SetProcessDelegate(delegate (List<DACName> list)
{
SaveFile(list, true);
});
}
public static void SaveFile(List<DACName> list, bool aIsMassProcess)
{
new KWProcessWorkCenterOpenJobReports().save(list, aIsMassProcess);
}
public virtual void save(List<DACName> list, bool aIsMassProcess)
{
//here at this point we are getting error
Report _report = ReportLoader.LoadReport("AA501108", null);
}
}