New Functions For Redirect In Acumatica

 

Hello everybody,

today I want to say few words about new functions for redirect in Acumatica, and particularly about class PXRedirectHelper. 

Classical approach from T200/T300 manual may look like this:

var currentCse = Cases.Current;
if(currentCse == null)
	return;
 
 
var graph = PXGraph.CreateInstance<CRCaseMaint>();
graph.Case.Current = graph.Case.Search<CRCase.caseCD>(currentCse.CaseCD);
if (graph.Case.Current != null)
{
	throw new PXRedirectRequiredException(graphtrue"Case details");
}

But with new function all of those lines can be simplified to this:

PXRedirectHelper.TryRedirect(Cases.Cache, Cases.Current, "Edit case"PXRedirectHelper.WindowMode.NewWindow);

With that approach you'll get the same result, but just in one line of code.