Skip to main content
Answer

Unable to override an Action on PO screen as it has an optional parameter

  • November 26, 2025
  • 2 replies
  • 38 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I have the same question as this topic which never received an answer:

 

I need to override the EmailPurchaseOrder action to do a simple update to a custom field.

		public delegate IEnumerable emailPurchaseOrder(PXAdapter adapter, [PXString] string notificationCD = null);
[PXButton(CommitChanges = true), PXUIField(DisplayName = "Email PO")]
[PXOverride]
public virtual IEnumerable EmailPurchaseOrder(
PXAdapter adapter,
[PXString]
string notificationCD = null, emailPurchaseOrder BaseMethod)
{
//Logic Here

I get an error that the optional parameter must be the last item in the method.

Any solutions for this?

Best answer by aleksandrsechin

Hi ​@Joe Schmucker 
Try this approach. The only thing I changed is that the parameter BaseMethod is now optional.

public delegate IEnumerable emailPurchaseOrder(PXAdapter adapter, [PXString] string notificationCD = null);
[PXButton(CommitChanges = true), PXUIField(DisplayName = "Email PO")]
[PXOverride]
public virtual IEnumerable EmailPurchaseOrder(PXAdapter adapter,
[PXString]
string notificationCD = null,
emailPurchaseOrder BaseMethod = null)
{
//Logic Here
}


 

2 replies

Forum|alt.badge.img+3

Hi ​@Joe Schmucker 
Try this approach. The only thing I changed is that the parameter BaseMethod is now optional.

public delegate IEnumerable emailPurchaseOrder(PXAdapter adapter, [PXString] string notificationCD = null);
[PXButton(CommitChanges = true), PXUIField(DisplayName = "Email PO")]
[PXOverride]
public virtual IEnumerable EmailPurchaseOrder(PXAdapter adapter,
[PXString]
string notificationCD = null,
emailPurchaseOrder BaseMethod = null)
{
//Logic Here
}


 


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • November 27, 2025

Hi ​@aleksandrsechin  Thank you!!  That worked like a charm!!