On my custom page, I have an action to open the Recalculate Customer Balances screen (AR509900)
public PXAction<RecordsToProcessFilter> Rebuild;
PXButton(CommitChanges = true)]
rPXUIField(DisplayName = "Rebuild Accounts")]
protected virtual IEnumerable rebuild(PXAdapter adapter)
{
var graph = PXGraph.CreateInstance<ARIntegrityCheck>();
throw new PXRedirectRequiredException(graph, false,
"Rebuild Accounts");
}
There are two versions of this screen. The new one and the (old) one.
When the graph gets instantiated, the highlighted line sees the screen being called from IC501010, not AR509900. Thus, it kicks me to the else section and uses the OLD way of doing it. It actually opens screen ID AR509901. The arReleaseGraph actually errors out when recalculating a customer in the U100 sample data, whereas the new way does not. Plus, the new way is a LOT faster.
protected virtual void _(Events.RowSelected<ARIntegrityCheckFilter> e)
{
ARIntegrityCheckFilter filter = Filter.Current;
bool errorsOnForm = PXUIFieldAttribute.GetErrors(e.Cache, null, PXErrorLevel.Error, PXErrorLevel.RowError).Count > 0;
a PXUIFieldAttribute.SetRequired<ARIntegrityCheckFilter.finPeriodID>(e.Cache, filter.RecalcDocumentBalances == true || filter.RecalcCustomerBalancesReleased == true);
ARCustomerList.SetProcessEnabled(!errorsOnForm);
ARCustomerList.SetProcessAllEnabled(!errorsOnForm);
ARCustomerList.SuppressMerge = true;
ARCustomerList.SuppressUpdate = true;
if (this.Accessinfo.ScreenID == RECALCULATE_CUSTOMER_BALANCES_SCREEN_ID)
{
ARCustomerList.SetProcessDelegate(
delegate (ARIntegrityCheck integrityCheckGraph, Customer cust)
{
integrityCheckGraph.Clear(PXClearOption.PreserveTimeStamp);
integrityCheckGraph.IntegrityCheckProc(cust, filter);
}
);
ARCustomerList.SetParametersDelegate(delegate (List<Customer> list)
{
if (
filter.RecalcDocumentBalances != true &&
filter.RecalcCustomerBalancesReleased != true &&
filter.RecalcCustomerBalancesUnreleased != true)
{
throw new PXException(Messages.SelectBalancesToBeRecalculated);
}
return true;
});
}
else
{
ARCustomerList.SetProcessDelegate<ARReleaseProcess>(
delegate (ARReleaseProcess arReleaseGraph, Customer cust)
{
arReleaseGraph.Clear(PXClearOption.PreserveTimeStamp);
arReleaseGraph.IntegrityCheckProc(cust, filter.FinPeriodID);
}
);
//For perfomance recomended select not more than maxCustomerCount customers,
//becouse the operation is performed for a long time.
const int maxCustomerCount = 5;
ARCustomerList.SetParametersDelegate(delegate (List<Customer> list)
{
bool processing = true;
if (PX.Common.PXContext.GetSlot<PX.SM.AUSchedule>() == null && list.Count > maxCustomerCount)
{
WebDialogResult wdr = ARCustomerList.Ask(Messages.ContinueValidatingBalancesForMultipleCustomers, MessageButtons.OKCancel);
processing = (wdr == WebDialogResult.OK);
if(!processing)
throw new PXException(Messages.SelectBalancesToBeRecalculated);
}
return processing;
});
}
}
How can I open AR509900 from my custom screen? It seems like there should be a SIMPLE REDIRECT. Is there a way I can get AR509900 to open “cleanly” and not see it as coming from my screen?
If not, I am considering copying and pasting the entire graph just to remove that IF statement.