Skip to main content

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);
        }
    }

Hi @ckwiat46  When I check the Report Loader syntax is like below, and it may not be the root cause of this issue 

    var _report = ReportLoader.LoadReport(source.ReportID, incoming: null);

 

Also, Are you able to AA501108, open this report successfully?


Hello Naveen, I changed the syntax as you suggested but that didn’t worked, also we are able to open the report successfully. Another point, our code is working if we don’t use process screen, i mean, instead of process screen we placed our code in custom button in Invoice screen and that is working. 


@Naveen Boga sorry to bother, but do you have any ideas? many thanks, much appreciated. 


Does anyone have any additional insight here? We will also post to stackoverflow on the hopes that someone can help.


Hi @ckwiat46  It should work but I’m not sure in this case.

Please raise a support case with Acumatica, you will get the solution from the Acumatica team.


@Naveen Boga unfortunately Acumatica will not help us without a direct support plan, so if you have any other ideas that would be much appreciated. Or if anyone else out there has any ideas, we would very much welcome those too. Thank you! @Doug Johnson maybe you can help get some eyes on this?


Reply