'Getting error while processing print from custom processing screen

I have created a Processing screen, To process EMAIL and PRINT of multiple Payment and Application documents.

While Processing PRINT I am getting the following ERROR. [enter image description here][1]

The Screen ID showing in the error message is the report screen ID which should pop up to print the report. but the Report is not popping up.

[enter image description here][2]

We are getting error in line no 72, throw ex;

I am unable to find out where I am going wrong,

Thanks In Advance. [1]: https://i.stack.imgur.com/IZbKN.png [2]: https://i.stack.imgur.com/i1oLj.png

Please refer image for more clarification...



Solution 1:[1]

Add the following to the code to find out more information

if (ex!=null)
{..}
else
{
   PXTrace.WriteError(ex);
   throw new PXException(ex.Message);
}

Solution 2:[2]

It looks like the code snippet you showed is of ARPaymentEntry graph extension however you also mention that it is a custom processing screen. If you have added this action to the Payments screen, then try the below code snippet. You could use one of the overrides of PXReportRequiredException method as needed.

public PXAction<PX.Objects.AR.ARPayment> PrintReceipt;

        [PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Print Official Receipt")]
        protected IEnumerable printReceipt(PXAdapter adapter)
        {
            Base.Save.Press();
            string reportID = "AR302070";
            List<ARPayment> list = adapter.Get<ARPayment>().ToList();
            int i = 0;
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            foreach (ARPayment payment in list)
            {
                parameters["PaymentType"] = payment.DocType;
                parameters["PaymentNbr"] = payment.RefNbr;

                i++;
            }
            if (i > 0)
            {
                throw new PXReportRequiredException(parameters, reportID, string.Format("Report {0}", reportID));
            }
            return list;
        }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patrick Chen
Solution 2 Raj