I have a custom table that stores the customer ID of customers that have been merged in my “Merge Customers” application. After customers get merged, I want to automatically select them to be processed on the Recalculate Customer Balances screen. After merging, it is just simpler to let Acumatica calculate the new customer balances than to do it myself.
I created an extension for that graph. The idea is that I redirect to this screen at the end of the Merge Customers process and the user simply has to click PROCESS on the screen as all the affected customers would be selected already.
In the extension, I thought I could use the RowInserting method on the grid to check the box on the line if it was in my custom table. That line doesn’t fire when the grid is being filled from the related View. I also tried FieldVerifying on the Customer field of the grid (and a few others) but they don’t fire unless you actually interact with the grid.
Just to try to get something to work, I committed a sin and put my code in the RowSelected event for the Filter. I KNOW this is bad, but it was a last resort to test my idea.
The code checks the box on the lines that have a matching record in my table. BUT, they are not seen as being checked because the cache is not seen as updated by my changing the selected value on the line item.
namespace PX.Objects.AR
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class ARIntegrityCheck_Extension : PXGraphExtension<PX.Objects.AR.ARIntegrityCheck>
{
#region Event Handlers
protected void Customer_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
Customer row = (Customer)e.Row;
if (row == null) return;
ICSCustomersToRebuild cust = SelectFrom<ICSCustomersToRebuild>.Where<ICSCustomersToRebuild.customerID.IsEqual<@P.AsInt>>.View.Select(Base, row.BAccountID);
if (cust != null)
{
row.Selected = true;
}
}
#endregion
}
}
What method would I use to “cycle” through the grid and update the selected checkbox after the View has been loaded?
Best answer by Leonardo Justiniano
View original