Skip to main content
Question

How to create a custom redirection exception

  • November 13, 2025
  • 4 replies
  • 54 views

Is it possible to create a custom redirect exception? We have a requirement that at the end of a process we need to redirect to a file and a report. I have seen the PXRedirectWithReportException and thought we could recreate a version of this to redirect to a file instead of a report. Is this possible? I have seen this page Creating a Custom Exception, where it mentions “To create a custom redirect exception, you must derive a class from the PX.Data.PXBaseRedirectException base class.” There is no documentation (that I have seen) that shows how to do this. Are there any examples of custom redirection exceptions? Or an explanation on how these work? Or source code on this?

4 replies

Forum|alt.badge.img+1

In order to redirect to a file, PXRedirectToFileException can be used.

The help article should provide an example on how to generate and redirect to a excel file.

Hope this helps!


@varthinibhaskaran18 Sorry, I don’t think I was clear enough. I need to redirect to a file and a report at the same time. However, I am only able to throw one exception, so I can either display the report, or get the file, not both. I had thought that the way to do both was to create a custom exception, similar to how the PXRedirectWithReportException redirects to the reports, and a page at the same time.


darylbowman
Captain II
Forum|alt.badge.img+15

You may have seen this, but worth a look.


@darylbowman Thanks, that help me to combine the report redirects which worked. Now I am trying to combine a PXRedirectToFileException and a PXReportRequiredException. I have tried this, but it only sends the PXRedirectToFileException or the PXReportRequiredException, not both.

PXLongOperation.StartOperation(graph, () =>
{
throw fileExc; //PXRedirectToFileException
});

throw reportExc; //PXReportRequiredException

This is inside of another PXLongOperation.StartOperation.