I am making updates to various tables in AR. After making the changes, I want to recalculate customer balances using the ARIntegrityCheck graph.
I created the graph instance. My goal is to “check” the box on the customer number I want to recalculate. After I initialize the graph, all of the caches are empty. When you open the screen, the grid is populated with all the customer id’s. I thought that by creating the graph instance, the caches would be populated through the events on the graph.
I’ve tried everything I can think of to get the graph “loaded”.
As per below, I am trying to get a current record for the customer number I am updating. I set the checkbox to true for Selected and update the current.
At the end, I click the Process button using a technique I found on Stackoverflow. I get a PXAction exception because I don’t think there is an “action” on the graph I can call.
var arIntegrityCheck = PXGraph.CreateInstance<ARIntegrityCheck>();
//arIntegrityCheck.Load();
//arIntegrityCheck.Actions.PressCancel();
//arIntegrityCheck.Clear();
arIntegrityCheck.Filter.Current.FinPeriodID = "201201";
arIntegrityCheck.Customers.View.RequestRefresh();
arIntegrityCheck.ARCustomerList.View.RequestRefresh();
Customer cust = SelectFrom<Customer>.Where<Customer.bAccountID.IsEqual<ARRegisterFilter.toCustomerID.FromCurrent>>.View.Select(this);
arIntegrityCheck.Customers.Current = arIntegrityCheck.ARCustomerList.Select(cust);
arIntegrityCheck.Customers.Current.Selected = true;
arIntegrityCheck.Customers.UpdateCurrent();
arIntegrityCheck.ARCustomerList.SetProcessEnabled(true);
try
{
arIntegrityCheck.Actions["Process"].Press();
}
catch (Exception e)
{
string joe = "joe";
}
I think there are two problems:
- I can’t figure out how to get the graph created and get the Views populated
- I don’t know how I can fire the Process button to do the work on the selected customer.
Any guidance would be appreciated.
Best answer by Gabriel Michaud
View original