Hello Community,
I am building a custom processing screen in Acumatica and facing an issue where the processing dialog (popup) is not showing when I click "Process" or "Process All."
Can someone help me figure out what I’m missing? Below is the code I am using.
public class BusinessAccountMaintTSExt : PXGraph<BusinessAccountMaintTSExt>
{
// Use PXFilter for ProcessFilter
public PXFilter<ProcessFilter> Filter;
public PXProcessingJoin<BAccount, LeftJoin<Customer, On<Customer.bAccountID, Equal<BAccount.bAccountID>>>,
Where<Customer.bAccountID, IsNull,
And<BAccount.type, NotEqual<BAccountType.customerType>,
And<BAccount.type, NotEqual<BAccountType.vendorType>,
And<BAccount.type, NotEqual<BAccountType.employeeType>,
And<BAccount.type, NotEqual<BAccountType.combinedType>,
And<BAccount.type, NotEqual<BAccountType.branchType>,
And<BAccount.type, NotEqual<BAccountType.empCombinedType>>>>>>>>> ItemsProcessing;
public BusinessAccountMaintTSExt()
{
ItemsProcessing.SetProcessDelegate(
delegate (List<BAccount> list)
{
PXLongOperation.StartOperation(this, delegate
{
ProcessItems(list, Filter.Current);
});
});
}
public virtual void ProcessItems(List<BAccount> list, ProcessFilter filter)
{
if (list == null || list.Count == 0) return;
if (filter == null || string.IsNullOrEmpty(filter.CustomerClassID))
{
// Acuminator disable once PX1050 HardcodedStringInLocalizationMethod [Justification]
throw new PXException("Customer Class ID is required.");
}
// Process each selected item
foreach (BAccount ba in list)
{
try
{
ProcessSingleItem(ba, filter.CustomerClassID);
PXProcessing<BAccount>.SetProcessed();
}
catch (Exception ex)
{
PXProcessing<BAccount>.SetError(ex.Message);
PXTrace.WriteError($"Error processing {ba.AcctCD}: {ex.Message}");
}
}
}
public virtual void ProcessSingleItem(BAccount ba, string customerClassID)
{
BusinessAccountMaint graph = PXGraph.CreateInstance<BusinessAccountMaint>();
graph.BAccount.Current = graph.BAccount.Search<BAccount.bAccountID>(ba.BAccountID);
if (graph.BAccount.Current == null)
{
// Acuminator disable once PX1050 HardcodedStringInLocalizationMethod [Justification]
throw new PXException("Business Account not found.");
}
if (graph.BAccount.Current.Type == BAccountType.CustomerType)
{
// Acuminator disable once PX1050 HardcodedStringInLocalizationMethod [Justification]
throw new PXException("This Business Account is already a Customer.");
}
CustomerMaint customerGraph;
try
{
// Get the ExtendToCustomer extension
var ext = graph.GetExtension<BusinessAccountMaint.ExtendToCustomer>();
if (ext == null)
{
// Acuminator disable once PX1051 NonLocalizableString [Justification]
throw new PXException(PX.Objects.CR.MessagesNoPrefix.CannotConvertBusinessAccountToCustomer);
}
// Call the Extend method on the extension instance
customerGraph = ext.Extend();
if (customerGraph == null || customerGraph.BAccount.Current == null)
{
// Acuminator disable once PX1051 NonLocalizableString [Justification]
throw new PXException(Messages.FailedToCreateCustomerGraph);
}
}
catch (Exception ex)
{
// Acuminator disable once PX1051 NonLocalizableString [Justification]
throw new PXException(Messages.FailedToCreateCustomerGraph, ex.Message);
}
// Set customer class ID
customerGraph.BAccount.Current.CustomerClassID = customerClassID;
// Handle class change
customerGraph.BAccount.View.Answer = WebDialogResult.Yes;
customerGraph.BAccount.UpdateCurrent();
customerGraph.Actions.PressSave();
// PXTrace.WriteInformation($"Successfully converted {ba.AcctCD} to customer");
}
Any advice or example would be really appreciated!
Thank you in advance!