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.
today I want to notice what kind of redirections are available in Acumatica:
- PXRedirectRequiredException opens the specified application page in the same window or a new one. By default, the user is redirected in the same window.
- PXPopupRedirectException opens the specified application page in a pop-up window.
- PXReportRequiredException opens the specified report in the same window or a new one. By default, the report opens in the same window.
- PXRedirectWithReportException opens two pages: the specified report in a new window, and the specified application page in the same window.
- PXRedirectToUrlExceptionopens the webpage with the specified external URL in a new window. This exception is also used for opening an inquiry page that is loaded into the same window by default.