Solved

How to add custom filter to Credit Card Processing for Sales processing screen?

  • 13 April 2022
  • 2 replies
  • 41 views

Userlevel 1

I need to add a filter to the Credit Card Processing for Sales screen (SO.50.70.00) so that only records where the DocType = Invoice will show, based on an additional custom checkbox in the filter section called "Invoices Only".

public class SOPaymentProcess_Extension : PXGraphExtension<SOPaymentProcess>
{
protected delegate void AddFiltersDelegate(PXSelectBase<ARPayment> view, SOPaymentProcessFilter filter);
[PXOverride]
protected virtual void AddFilters(PXSelectBase<ARPayment> view, SOPaymentProcessFilter filter, AddFiltersDelegate baseMethod)
{
baseMethod(view, filter);

SOPaymentProcessFilterExt filterExt = PXCache<SOPaymentProcessFilter>.GetExtension<SOPaymentProcessFilterExt>(filter);

if (filterExt.UsrInvoicesOnly != null)
{
// filtering code here
}
}
}

public class SOPaymentProcessFilterExt : PXCacheExtension<PX.Objects.SO.DAC.Unbound.SOPaymentProcessFilter>
{
#region UsrInvoicesOnly
public abstract class usrInvoicesOnly : PX.Data.BQL.BqlString.Field<usrInvoicesOnly> { }
[PXBool]
[PXUIField(DisplayName = "Invoices Only")]
[PXDefault(true)]
public virtual bool? UsrInvoicesOnly { get; set; }
#endregion
}

I've tried overriding the AddFilters() method (see above), but this error is thrown during runtime:

Attempt by method 'Wrapper.PX.Objects.SO.Cst_SOPaymentProcess.AddFiltersGeneratedWrapper(PX.Objects.SO.SOPaymentProcess, PX.Data.PXSelectBase`1, PX.Objects.SO.DAC.Unbound.SOPaymentProcessFilter)' to access method 'PX.Objects.SO.SOPaymentProcess_Extension+AddFiltersDelegate..ctor(System.Object, IntPtr)' failed.

 

I'm puzzled because the AddFilters() base method is not private. Any suggestions?

icon

Best answer by markusray17 13 April 2022, 20:51

View original

2 replies

Userlevel 6
Badge +3

I believe your method needs to be public for PXOverride to work, try something like:

public class SOPaymentProcess_Extension : PXGraphExtension<SOPaymentProcess>
{
public delegate void AddFiltersDelegate(PXSelectBase<ARPayment> view, SOPaymentProcessFilter filter);
[PXOverride]
public virtual void AddFilters(PXSelectBase<ARPayment> view, SOPaymentProcessFilter filter, AddFiltersDelegate baseMethod)
{
baseMethod(view, filter);

SOPaymentProcessFilterExt filterExt = PXCache<SOPaymentProcessFilter>.GetExtension<SOPaymentProcessFilterExt>(filter);

if (filterExt.UsrInvoicesOnly != null)
{
// filtering code here
}
}
}

 

Userlevel 1

Doh! That worked. Thanks for the tip @markusray17

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 — 2022  Acumatica, Inc. All rights reserved