Skip to main content
Answer

How to stop the PXRedirectRequiredException action

  • July 15, 2024
  • 6 replies
  • 103 views

Forum|alt.badge.img

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.

Best answer by darylbowman

Have you tried something like this?

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

}

POButtonPressed(adapter);

 

6 replies

darylbowman
Captain II
Forum|alt.badge.img+15

Have you tried something like this?

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

}

POButtonPressed(adapter);

 


DipakNilkanth
Pro III
Forum|alt.badge.img+13

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!


Forum|alt.badge.img

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.

 


darylbowman
Captain II
Forum|alt.badge.img+15

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.


DipakNilkanth
Pro III
Forum|alt.badge.img+13

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.


Forum|alt.badge.img

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  😍