Skip to main content
Solved

How to stop the PXRedirectRequiredException action

  • 15 July 2024
  • 6 replies
  • 60 views

Hi Everyone,

We are trying to automatically create a Purchase Order from an Appointment form.

The functionality is almost complete, but I am encountering an issue when I call the Create Purchase Order (CreateProc) function within the POCreate graph. It redirects to the Purchase Orders form after executing the CreateProc function, and the subsequent functionality does not work.

POCreate graphPOCreate = PXGraph.CreateInstance<POCreate>();

graphPOCreate.Filter.Cache.RestoreCopy(graphPOCreate.Filter.Current, filter);

graphPOCreate.CreateProc(list, filter.PurchDate, filter.OrderNbr != null, filter.BranchID);

POButtonPressed(adapter);

POButtonPressed this function not executed.

Plz tell me how to resolve this..?

 

Thanks

Nageswararao A.

6 replies

Badge +12

Have you tried something like this?

try
{
graphPOCreate.CreateProc(...);
}
catch (PXRedirectRequiredException ex)
{

}

POButtonPressed(adapter);

 

Userlevel 6
Badge +4

Hi @NageswaraRaoAddanki60 ,

You can override the CreateProc method and call your custom method POButtonPressed within the same overridden method, ensuring it executes subsequently

 

 public delegate void CreateProcDelegate(List<POFixedDemand> list, DateTime? purchaseDate, bool extOrderNbr, int? branchID);

[PXOverride]
public void CreateProc(List<POFixedDemand> list, DateTime? purchaseDate, bool extOrderNbr, int? branchID, CreateProcDelegate baseMethod)
{

baseMethod(list, purchaseDate, extOrderNbr, branchID);


POButtonPressed();
}

Hope, it helps!

Userlevel 2
Badge

Have you tried something like this?

try
{
graphPOCreate.CreateProc(...);
}
catch (PXRedirectRequiredException ex)
{

}

POButtonPressed(adapter);

 

Hi @darylbowman 

Now, it’s working fine.

Thank you for your support.

 

Badge +12

Hi @NageswaraRaoAddanki60 ,

You can override the CreateProc method and call your custom method POButtonPressed within the same overridden method, ensuring it executes subsequently...

This is also a valid solution, however, it's important to note that this will change the signature of the CreateProc, meaning the POButtonPressed code will run every time CreateProc does anywhere it's called in Acumatica. This may be appropriate or it may not.

Userlevel 6
Badge +4

Hi @darylbowman ,

Thank you for shedding light on my approach. Yes, you are right. Sometimes, it is not appropriate since it will be called every time the CreateProc method is executed from anywhere.

Userlevel 2
Badge

Hi @NageswaraRaoAddanki60 ,

You can override the CreateProc method and call your custom method POButtonPressed within the same overridden method, ensuring it executes subsequently...

This is also a valid solution, however, it's important to note that this will change the signature of the CreateProc, meaning the POButtonPressed code will run every time CreateProc does anywhere it's called in Acumatica. This may be appropriate or it may not.

That is not possible  at this time. CreateProc  function calling from Appointment form buttons. 

anyway…. you both are awesome.

 

Thank you @Dipak Nilkanth ,  @darylbowman  😍

Reply