Solved

Custom Field using StringList Instead of IntList

  • 13 July 2021
  • 6 replies
  • 631 views

Userlevel 2
Badge

I tried to create an attribute and then a UDF for a custom field I need to add to the Contact form.  I created a custom project, I created the new field (as a string of length 10) and I added it to the Contacts form.  By Default, everything works fine.  It’s a string field and I am able to enter and save values.  However, I want to change it to a combo box so I can restrict the user’s entries.  In my custom project, I go to “customize” the attributes and I use the following:

[PXDBString(10)]
[PXStringList(new string[] {"N", "P", "Y"}, new string[] {"No", "Pending", "Yes"})]
[PXUIField(DisplayName="Status")]

It always gives me a TextEdit.  Am I missing a line of code?

In the past, I have created the new field as an Integer and used the following code:

[PXDBInt]
[PXIntList(new int[] {1, 2, 3}, new string[] {"No", "Pending", "Yes"})]
[PXUIField(DisplayName="Status")]

This works and I could do this but I’m trying to keep the values as string and not integers.

 

icon

Best answer by Naveen Boga 13 July 2021, 15:27

View original

6 replies

Userlevel 7
Badge +17

yes @PRapnikas  We can do it.  Please find the sample code below.

[PXStringList(new string[] {"N", "P", "Y"}, new string[] {"No", "Pending", "Yes"}, MultiSelect =true)]

 

Userlevel 7
Badge +17

Hi @PRapnikas  Code looks good, can you please also confirm that you have given the <PXDropdown> control in .aspx page ?

<px:PXDropDown ID="edStatus" runat="server" DataField="Status"> </px:PXDropDown>

Userlevel 2
Badge

That might be the problem.  I am only adding the code I listed above.  I’m new to Acumatica and learning quickly, but I am not modifying any code directly.  Everything I do is through the UI.  Also, we are on a hosted solution.  If this is something I can do from the Project Editor, then please let me know where and I will try it.  

Userlevel 2
Badge

Actually, I played around with this and was able to make the modification.  Worked great.  Thanks for the help.

Userlevel 7
Badge +17

@PRapnikas  Great :) Thanks for sharing an update.

Userlevel 2
Badge

A quick question.  Is it possible to make that combobox a multi-select?  If so, how would I do that?

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