Skip to main content

Creating Advanced Settings Screens

  • September 24, 2023
  • 2 replies
  • 243 views

Kyle Vanderstoep
Jr Varsity III
Forum|alt.badge.img+1

Often, when creating a large customization, the “Preferences” screen can get very complex. It may take more definition than a single XYZSetup DAC to hold all the configuration required. Perhaps you need both a FormView editing a YourCstSetup DAC as well as a grid editing a collection of YourCstDetailSetup DAC rows. Or perhaps you would like to have two unrelated FormViews UsrCSTSetup1 and YourCstSetup2. For brevity’s sake, it would be better to include both these on the same “Preferences” screen. I will show you why this is difficult, as well as how to do it.

The reason something like this is difficult is due to the way that Acumatica handles PXActions. I am sure that you have seen action definitions as

public PXAction<TheMainDACOfTheGraph> SomeAction;
// or
public PXSave<TheMainDACOfTheGraph> Save;

 

What happens is when that save button is pushed, the changes held in the cache are persisted to the database of course. The problem occurs when you have two DACs that do not have any relationship to one another (usually defined by .Current<> included in the detail data view definition and a PXParent on the detail row.). What you will find happens is, if you make a change to the Detail DAC, you will not be able to save your changes until you make some change to the primary DAC.

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

2 replies

Kyle Vanderstoep
Jr Varsity III
Forum|alt.badge.img+1

(I was having a hard time posting this in one message so I broke it out into 2 )


This can be very poor user experience on a screen like a preference screen, where there is no innate link between the master and detail. I will show you how to do this without ruining the PXSave action. Consider the following graph:

using System;
using PX.Data;

namespace Blog
{
  public class DemoGraph : PXGraph<DemoGraph>
  {

    public PXSave<MasterTable> Save;
    public PXCancel<MasterTable> Cancel;


    public PXSelect<MasterTable> MasterView;
    public PXSelect<DetailsTable> DetailsView;
  }
}

Both the MasterTable and the DetailsTable contain a field “Prepayment Percent” The major change is in the aspx as shown below. The first view ‘MasterView’, which is the primary view is not used to create a form. Rather, the dataview is bound to the PXTab directly and the "prepayment percent" field control is created directly without a form. The second view, ‘DetailsView’ is then bound to a form within the tab.


Here any change to the fields that are bound to ‘DetailsView’ not only enables the save button but also save the values on click of the save button. Therefore, the user can edit and save values on either tab, with no link between the DACs, and have a proper user experience.

Happy coding!

-Kyle


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2756 replies
  • September 25, 2023

Thank you for sharing this information with the community @Kyle Vanderstoep!


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