Loading ...

Hos To Add List Values To Drop Down In Acumatica

Hello everybody,

today I want to make quick notice of how to make drop down values in Acumatica avalable. 

Let's imagine, that you need following drow down list:

 

dropdownValues.png
drop down values

 

 

In order to get this kind of list, you can use the following code:

public static class JiraAccountStatusEnum
{
      public const string Open = "O";
      public const string Closed = "C";
      public const string Archived = "A";
}

public class JiraAccountListAttribute : PXStringListAttribute
{
   public JiraAccountListAttribute() : base(
            new string[] {JiraAccountStatusEnum.Open, JiraAccountStatusEnum.Closed, 
JiraAccountStatusEnum.Archived}, new string[] {"Open", "Closed", "Archived"}) { } }

2. In your DAC member class write the following:

#region UsrStatus
public abstract class usrStatus : IBqlField
{
}

protected string _UsrStatus;
[PXUIField(DisplayName = "Status")]
[PXDBString(10)]
[JiraAccountList]
public virtual string UsrStatus
{
   get
      {
        return _UsrStatus;
      }
   set
      {
        _UsrStatus = value;
      }
}
#endregion

3. Finally in your aspx page use the following control:

<px:PXDropDown ID="pxddUsrStatus" runat="server" DataField="UsrStatus"></px:PXDropDown>

That's it what is needed. If you follow steps, mentioned in this notice, you'll get drop down, screenshot of which you've seen.