Creating Advanced Settings Screens

  • 24 September 2023
  • 2 replies
  • 103 views

Userlevel 3
Badge +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.


2 replies

Userlevel 3
Badge +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

Userlevel 7
Badge

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

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