Solved

Display processing dialog with PXProcessButton

  • 7 August 2021
  • 6 replies
  • 584 views

Userlevel 3
Badge +1

I have a custom processing screen:

In order to get the non-intrusive validation to work I had to create my own PXProcessButton vs. using the built-in processing delegate.  All is working, however, now that I have done this I don’t have a processing dialog, just a little green dot that shows everything processed.  How can I show the processing dialog in this scenario?  FYI, I used code in AR507000 (Calculate Overdue charges) as the example for hooking up a custom processing button and having my required fields validate in this way prior to processing.  Client didn’t like the behavior of just throwing PXExceptions.

Here is my custom PXProcessButton:

 

        public PXAction<PMTaskToAssignFilter> Assign;

        [PXUIField(DisplayName = "Assign", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]

        [PXProcessButton]

        public virtual IEnumerable assign(PXAdapter adapter)

        {

            PMTaskToAssignFilter filter = Filter.Current;

            if (!CheckRequiredFieldsFilled(Filter.Cache, filter))

            {

                return adapter.Get();

            }

            List<PMTask> pMTasks = new List<PMTask>();

            foreach (PMTask task in Tasks.Select())

            {

                if (task.Selected ?? false)

                {

                    pMTasks.Add(task);

                }

            }

            if (pMTasks.Count == 0) {

                // Acuminator disable once PX1050 HardcodedStringInLocalizationMethod [Justification]

                throw new PXException("No records selected!");

                

            }


            PXLongOperation.StartOperation(this, () =>

            {

                this.IsProcessing = true;

                PMTaskAssignValues assignGraph = PXGraph.CreateInstance<PMTaskAssignValues>();

                assignGraph.AssignValues(pMTasks, filter);

            });


            return adapter.Get();

        }

 

icon

Best answer by Naveen Boga 9 August 2021, 06:21

View original

6 replies

Userlevel 7
Badge +17

Hi @rjean09  You better have a logic in the default Acumatica button, instead of having new action and writing code for “Processing Dialogue” box.

 

If you see the default Acumatica Processing screens does not show any validations, always required fields will be populated with the defaults OR Process will execute if values are NOT present. 
 

Also, there is NO “Process All” action in your screen, is this processing screen ran by the user manually everytime? 

 

Userlevel 3
Badge +1

Hi @Naveen B 

I would prefer to use the default Acumatica Process button, however, I could not figure out how to get the type of field validation (see screen shot above) with that due to the static method and not having PXAdapter, etc.  User said the PXException method I was using was “ugly”.  (like you said, Process will execute so have to handle in static process method).  Yes, it was a requirement that Process All button be removed.  Users MUST select the rows they want processed.  So, all is “functional” but I’m getting complaints about the “look” of things.  New validation that works like AR507000 is nice, but side-effect with having to implement with custom PXProcessButton is that processing dialog is now gone.  Trying to make everyone happy but quite the struggle I’m having.

Userlevel 3
Badge +1

Also note, these required fields are not for filtering but are used to bulk update attributes in the process logic.  The filter is just based on Project ID and the assign drop down.

Userlevel 7
Badge +17

Hi @rjean09  Understood. Still, I can suggest go with the default “PROCESS” action instead of Custom action.

For the required fields, you can provide “Required = True” at the DAC level, so that fields will show as mandatory fields, but will NOT throw any validations.

For this, you can have view delegate for the Processing and check if these values are present then only records will be populated on the grid.

This way you can achieve processing popup and mandatory fields red mark. 

Userlevel 3
Badge +1

@Naveen B I checked with our implementer and they are OK with just having the green dot show for the processing results vs. having the processing dialog for this screen.  I had attempted to check the required values this way from the Process view delegate and had some trouble which is why I changed to a custom PXProcessButton.  If this comes back or comes up again I’ll explore trying to do this using the delegate and built-in process button again.  So, problem solved for now but thank you again for feedback and help.

Userlevel 7
Badge +17

Hi @rjean09 Sure. Thanks for sharing an update.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved