Question

Error in Process screen when attaching report to email

  • 14 November 2022
  • 6 replies
  • 115 views

Userlevel 2
Badge

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


6 replies

Userlevel 7
Badge +19

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?

Userlevel 2
Badge

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. 

Userlevel 2
Badge

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

Userlevel 2
Badge

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

Userlevel 7
Badge +19

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.

Userlevel 2
Badge

@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


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved