today I want to note about redirects. In Acumatica you can redirect user to another webpage. Acumatica provides option of redirecting to following scenarios:
- To another page in Acumatica
- To another report
- To any destination url
Try to gues, how redirections are implemented? As exception. If you consider it as wrong approach, I can partially agree with you. But only partially, because redirecting to antoher page is really some kind of exceptional situation.
Below goes code of redirecting to page PM302000 at some TaskID and some projectid selected, which will be opened in new window:
UsrPMTaskReplace taskRepl = JiraAccountTasks.Current;
ProjectTaskEntry graph = PXGraph.CreateInstance<ProjectTaskEntry>();
graph.Task.Current = Base.Task.Current;
graph.Task.Current.ProjectID = taskRepl.UsrProjectID;
if (graph.Task.Current != null)
throw new PXRedirectRequiredException(graph, true, "Project Tasks");
If to speak more about other kinds of redirects, here it goes full list:
- PXRedirectRequiredException. Goes inside of Acumatica to some screen, or opens new one in another window. By default user will stay in the same window.
- PXPopupRedirectException. Inside Acumatica will be opened pop-up window.
- PXReportRequiredException. Opens report in the same or new window.
- PXRedirectWithReportException. This one is really cool because it can open two pages: the specified report in a new window, and the specified application page in the same window.
- PXRedirectToUrlException. Specified external page will be opened in a new window. BTW, you can use this exception for opening inquiry page.