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)
    var orderTypes = SelectFrom<SOOrderType>.Where<<True>>.View.Select(this).Select(a => a.GetItem<SOOrderType>())
    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,
        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.

Comments are closed