Skip to main content
Answer

Can I override the PXRedirectRequiredException for an Action with code?

  • October 18, 2023
  • 3 replies
  • 121 views

I am trying to change the “Create Appointment” button on the Service Order screen so it opens up in a new window instead of the current. Is there a way I can only override part of the action?

Best answer by Vignesh Ponnusamy

Hi @MarcoL45,

You can invoke the base in the try and catch the PXRedirectRequiredException then use the information to redirect to the new window. Following is an example,

    public class ServiceOrderEntry_Extension : PXGraphExtension<PX.Objects.FS.ServiceOrderEntry>
{
#region Event Handlers
public delegate IEnumerable ScheduleAppointmentDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable ScheduleAppointment(PXAdapter adapter, ScheduleAppointmentDelegate baseMethod)
{
try
{
baseMethod(adapter);
}
catch (PXRedirectRequiredException e)
{

throw new PXRedirectRequiredException(e.Graph, false, "Appt") { Mode = PXBaseRedirectException.WindowMode.New };
}
return baseMethod(adapter);
}
#endregion
}

Good Luck.!

3 replies

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi @MarcoL45,

You can invoke the base in the try and catch the PXRedirectRequiredException then use the information to redirect to the new window. Following is an example,

    public class ServiceOrderEntry_Extension : PXGraphExtension<PX.Objects.FS.ServiceOrderEntry>
{
#region Event Handlers
public delegate IEnumerable ScheduleAppointmentDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable ScheduleAppointment(PXAdapter adapter, ScheduleAppointmentDelegate baseMethod)
{
try
{
baseMethod(adapter);
}
catch (PXRedirectRequiredException e)
{

throw new PXRedirectRequiredException(e.Graph, false, "Appt") { Mode = PXBaseRedirectException.WindowMode.New };
}
return baseMethod(adapter);
}
#endregion
}

Good Luck.!


  • Author
  • Freshman II
  • October 18, 2023

Thank you so much this worked as expected!


Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

@MarcoL45, Perfect, happy coding.!