Solved

Can I override the PXRedirectRequiredException for an Action with code?

  • 18 October 2023
  • 3 replies
  • 61 views

Userlevel 2

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?

icon

Best answer by Vignesh Ponnusamy 18 October 2023, 16:50

View original

3 replies

Userlevel 7
Badge +4

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.!

Userlevel 2

Thank you so much this worked as expected!

Userlevel 7
Badge +4

@MarcoL45, Perfect, happy coding.!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved