Skip to main content

I added a custom field UsrHoldForPaymentProcess to the Bills and Adjustments screen.  This field gets created in the APRegister table.  It is a checkbox to indicate that we do not want to show this bill on the Approve Bills for Payment screen.

 

On the Approve Bills for Payment screen, I want to only show Bills that do not have the UsrHoldForPaymentProcess field set to true.

One problem I see is that the select statement for the Approve Bills screen pulls from APInvoice, not APRegister.

 

To adjust what gets displayed in the grid, I want to override this method in the APApproveBills graph

private static Type getAPDocumentSelect(bool groupBy = false)
 

I cannot seem to get the override correct as I get an error that the signature does not match.

public delegate Type getAPDocumentSelectDelegate(bool groupBy = false);
ePXOverride]
public static Type getAPDocumentSelect(bool groupBy, getAPDocumentSelectDelegate baseMethod)
 

 

I tried to do what would seem like the EASY approach by adding a Where to the View in the initialize, but it does not have any impact.

Since the APDocumentList view uses the APInvoice table for the select, for testing, I created another extension field in the APInvoice table with the same Usr field name as in the APRegister table.  In SQL, I updated one record so that the field is set to true.  But the bill still shows in the grid.

public override void Initialize()
{
    this.Base.APDocumentList.WhereAnd<Where<TenFedAPInvoiceExt.usrHoldForPaymentProcess, IsNull, Or<TenFedAPInvoiceExt.usrHoldForPaymentProcess, Equal<boolFalse>>>>();
}
 

I think if I can get the signature figured out, I can do the join from APInvoice to APRegister and restrict the returned query to remove the records where my Usr field is true.  It means copying a lot of Acumatica lines and making a couple tweaks, but I think that would work.

Help!  :-)

Unfortunately, you can’t override static methods with ePXOverride]


Thanks @darylbowman .  That is good to know, but bad for the customer.  

I don’t think I can do what they are asking.  If I can’t modify the PXView used for the grid, then I can’t change the results in the grid.

I will let them know that this is not an option for them.


Hi @Joe Schmucker 

While you can’t override the getAPDocumentSelect, you can override the apdocumentlist() data handler. It will require a lot of copy-paste just to replace getAPDocumentSelect call with your modified query, but it should get the job done.


@andriitkachenko , That is also good to know.  You are right that it would be a lot of duplicating Acumatica’s code.  In this case, it is not a “show stopper” for the customer.  Instead of modifying the filter on the screen, I just added the Usr field to the grid and they can use filters to hide the on hold records.

I appreciate the idea.  If it was really badly needed, I’d do it.


Reply