Loading ...

How to Preselect Checkbox Values in Acumatica Dialogs

In Acumatica, certain actions trigger dialogs (pop-up panels) that contain options presented as checkboxes. If you want to preselect (auto-check) these options by default, you can do so by customizing the screen’s graph using a few simple techniques.

In this article, we'll show you a universal method to preselect checkbox fields in any dialog — and demonstrate it using the “Convert to Project” dialog from the PMQuoteMaint graph as an example.


Why use Initialize():

·        It's called when the screen (graph) is first loaded.

·        It allows you to access the current record of a dialog's cache (like ConvertQuoteInfo.Current).

·        It ensures the values are set before any user interaction or dialog rendering happens.

Let’s say we want the following checkboxes to be checked by default in the “Convert to Project” dialog:

·         Copy Notes

·         Copy Files

·         Create Labor Rates

·         Activate Project

·         Activate Tasks

·         Move Activities

Here’s how you can do that via a graph extension:

 

public class PMQuoteMaintExtension : PXGraphExtension<PMQuoteMaint>

{

    public static bool IsActive() => true;

 

    public override void Initialize()

    {

        var quoteInfo = Base.ConvertQuoteInfo.Current;

 

        if (quoteInfo == null)

            return;

        quoteInfo.CopyNotes = true;

        quoteInfo.CopyFiles = true;

        quoteInfo.CreateLaborRates = true;

        quoteInfo.ActivateProject = true;

        quoteInfo.ActivateTasks = true;

        quoteInfo.MoveActivities = true;

    }

}

ConvertQuoteInfo is a data view in PMQuoteMaint that represents the dialog’s data model.
For now, every time you open the "Convert to Project" dialog, all the checkboxes will be automatically checked. This behavior ensures that the options are selected by default, which can be useful in many scenarios.