Solved

Custom field using [Inventory] attribute but not as a DB field

  • 24 August 2023
  • 2 replies
  • 47 views

Userlevel 6
Badge +3

I want to create a custom field using the [Inventory] attribute so that I get the selector and it is all sorted out for me.  I don’t want it to be PXDBInt.  I want it to be a virtual field of type PXInt.

        #region UsrModEquipTempID
        [Inventory]
        [PXUIField(DisplayName = "Model Equipment")]
        public int? UsrModEquipTempID { get; set; }
        public abstract class usrModEquipTempID : PX.Data.BQL.BqlInt.Field<usrModEquipTempID> { }
        #endregion

If I put [PXInt], it causes a compiler error.  

How can I do that?

 

 

icon

Best answer by Naveen Boga 24 August 2023, 17:01

View original

2 replies

Userlevel 6
Badge +3

@Naveen Boga Thank you so much for giving me the code!  

Userlevel 7
Badge +17

Hi @Joe Schmucker  Yes, [InventoryID] will not work with unbound field fields.

You can your DAC like below.

 

       #region FirstItem

[PXInt()]
[PXSelector(typeof(Search<InventoryItem.inventoryID, Where<InventoryItem.stkItem, Equal<True>,
And<InventoryItem.itemStatus, Equal<AMIConstants.ActiveStatus>>>>), new Type[] { typeof(InventoryItem.inventoryCD), typeof(InventoryItem.descr) }, SubstituteKey = typeof(InventoryItem.inventoryCD))]
[PXUIField(DisplayName = "Select Item", Required = true)]
public virtual int? FirstItem { get; set; }
public abstract class firstItem : IBqlField { }

#endregion

 

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