Skip to main content
Solved

Processing Dialog box not appearing on Custom processing screen


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

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!

Best answer by Samvel Petrosov

Nilkanth Dipak wrote:

Hi Samuel,

I have already tried using PXFilteredProcessing, but the Processing dialog box is still not displaying.

I cannot remove the filtering as I have added Customer Class as a filter, which is required when extending and saving a customer.

Do you have any other suggestions?

Just realized that you have a PXLongRunOperation in the SetProcessDelegate.

That is most likely what is causing the issue. SetProcessDelegate is expecting a function that it will run in a separate thread behind the scene.

View original
Did this topic help you find an answer to your question?

3 replies

Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+5

I think this has something to do with the way you are filtering the records.

Could you please try to completely remove the filtration and see if that fixes this?

If yes, then I guess you will need to switch to using PXFilteredProcessing

https://help.acumatica.com/(W(2))/Help?ScreenId=ShowWiki&pageid=939eba70-3702-92ec-598e-bd94c6455ac9


Nilkanth Dipak
Semi-Pro I
Forum|alt.badge.img+10

Hi Samuel,

I have already tried using PXFilteredProcessing, but the Processing dialog box is still not displaying.

I cannot remove the filtering as I have added Customer Class as a filter, which is required when extending and saving a customer.

Do you have any other suggestions?


Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+5
Nilkanth Dipak wrote:

Hi Samuel,

I have already tried using PXFilteredProcessing, but the Processing dialog box is still not displaying.

I cannot remove the filtering as I have added Customer Class as a filter, which is required when extending and saving a customer.

Do you have any other suggestions?

Just realized that you have a PXLongRunOperation in the SetProcessDelegate.

That is most likely what is causing the issue. SetProcessDelegate is expecting a function that it will run in a separate thread behind the scene.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings