Skip to main content
Answer

How to override Approval Action in Sales Order

  • June 17, 2025
  • 5 replies
  • 69 views

Forum|alt.badge.img

I want to customize approve action in sales Orders and go to override method in ui. I cannot see approve action. 

How to do it 

Best answer by aaghaei

Approval engine is one of the complicated and annoying pieces to override. Depending on what you intend to do, you might need to override one of the 4 derived classes of EPApprovalAutomation. All approval codes are executed inside these classes and graph itself doesn’t have anything really.

5 replies

Forum|alt.badge.img+1
  • Semi-Pro III
  • June 17, 2025

Hello ​@vannakheng 

Can you try below code

 [PXOverride]
public PXAction<SOOrder> approve;
[PXButton(CommitChanges = true),
PXUIField(DisplayName = "Approve", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable Approve(PXAdapter adapter)
{
return adapter.Get();
}

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • June 17, 2025

Approval engine is one of the complicated and annoying pieces to override. Depending on what you intend to do, you might need to override one of the 4 derived classes of EPApprovalAutomation. All approval codes are executed inside these classes and graph itself doesn’t have anything really.


Forum|alt.badge.img
  • Author
  • Freshman II
  • June 17, 2025

Approval engine is one of the complicated and annoying pieces to override. Depending on what you intend to do, you might need to override one of the 4 derived classes of EPApprovalAutomation. All approval codes are executed inside these classes and graph itself doesn’t have anything really.

Can you show me some example


Forum|alt.badge.img
  • Author
  • Freshman II
  • June 17, 2025

Hello ​@vannakheng 

Can you try below code

 [PXOverride]
public PXAction<SOOrder> approve;
[PXButton(CommitChanges = true),
PXUIField(DisplayName = "Approve", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable Approve(PXAdapter adapter)
{
return adapter.Get();
}

 

Method Void Approve(PX.Objects.SO.SOOrder, ApproveDelegate) in graph extension is marked as [PXOverride], but the original method with such name has not been found in PXGraph


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • June 17, 2025

@vannakheng If you click on my name and go to the posts and replies you will find a lots of topics/conversation in regarding the approval. I have worked intensely on Approval. The thing is Approval methods are executed twice if you try to override (you will see them in my posts), one through the class and second time through the Approval view. You can override the class but Approval view will give you a hard time in whatever you are trying to do as it attaches a tons of handlers to graph. Depending on what you want to do you definitely need VS to code and trace and you might spend days or weeks and spin around yourself. 

see these recent ones for example. I know you might think you want to do something different but it is guaranteed you will fall into the loopholes if you try to override anything in the Approval Workflow.

 

 

 

also we have something here that might interest you