Loading ...

How To Make Dynamic List With Check Boxes In Acumatica

Hello everybody,

today I want to share with you a piece of code, with help of which you can get list of all activer order types in Acumatica and also you'll get a chance to select those types with checkbox. Take a look on a screenshot below:

how to achieve this?

Code below without description of DAC class gives you this:

protected virtual void _(Events.FieldSelecting<SetupClassSetupClass.orderTypese)
{
    if (e.Row == null)
    {
        return;
    }
 
    var orderTypes = SelectFrom<SOOrderType>.Where<SOOrderType.active.IsEqual<True>>.View.Select(this).Select(a => a.GetItem<SOOrderType>())
        .ToList();
    var allowedValues = orderTypes.Select(a => a.OrderType).ToArray();
    var allowedLabels = orderTypes.Select(a => a.Descr).ToArray();
 
    var returnState = PXStringState.CreateInstance(e.ReturnValue, allowedLabels.Length, true,
        typeof(SetupClass.orderTypes).Name,
        false, -1, string.Empty, allowedValuesallowedLabelsfalsenull);
    (returnState as PXStringState).MultiSelect = true;
    e.ReturnState = returnState;
}

On aspx level, it look trivial:

<px:PXDropDown ID="PXDropDown1" runat="server" DataField="OrderTypes" CommitChanges="true" />

With help of this code, you'll get list of all order types, which you'll be able to persist in database.

Looking to customize Acumatica to fit your business needs even better? If you need a tailored solution like this or have specific customization requests, let’s make it happen!

👉 Leave a request today, and let’s build the perfect Acumatica experience for you.

Be the first to rate this post

  • Currently 0.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5