Skip to main content
Answer

Add field of InventoryItem to Purchase Order Line

  • June 2, 2025
  • 4 replies
  • 66 views

idrusm52
Jr Varsity III
Forum|alt.badge.img

Dear Support,

I have created custom field usrLookup on Inventoryitem and I want this field to add on column Purchase Order Line.

Please advise.

 

Thanks,
Idrus

Best answer by idrusm52

Thank you ​@Saikrishna V & ​@Nilkanth Dipak 

After check with GPT, I got the update code as below that working well.

using PX.Data;
using PX.Data.BQL;
using PX.Objects.IN;
using PX.Objects.PO;

namespace PX.Objects.PO
{
public class InventoryItemExt : PXCacheExtension<InventoryItem>
{
[PXDBString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Lookup Code")]
public string UsrLookup { get; set; }

public abstract class usrLookup : PX.Data.BQL.BqlString.Field<usrLookup> { }
}
public class POLineExtCustom : PXCacheExtension<POLine>
{
[PXString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Part No.", Enabled = false)]
[PXUnboundDefault(typeof(
Search<InventoryItemExt.usrLookup,
Where<InventoryItem.inventoryID, Equal<Current<POLine.inventoryID>>>>))]
[PXFormula(typeof(Default<POLine.inventoryID>))]
public string UsrInventoryLookup { get; set; }

public abstract class usrInventoryLookup : BqlString.Field<usrInventoryLookup> { }
}
}

 

4 replies

DipakNilkanth
Pro III
Forum|alt.badge.img+13

Hi ​@idrusm52,

  • Add Custom field in POLine.
  • You can use PXFormula in your DAC extension of POLine  for same custom field as shown below:


 [PXFormula(typeof(Selector<POLine.inventoryID, TSInventoryItemExtensions.usrLookup>))]

Note : Please set Commit Changes to true for the custom field

Hope, it helps!


Forum|alt.badge.img+1
  • Semi-Pro III
  • June 2, 2025

@idrusm52 

You can add a custom field in POLineExtension using the sample code below:

public class POLineExt : PXCacheExtension<POLine>
{
[PXDBString(50)]
[PXUIField(DisplayName = "Item Lookup")]
[PXFormula(typeof(
Search<InventoryItemExt.usrLookup,
Where<InventoryItem.inventoryID, Equal<Current<POLine.inventoryID>>>>))]
public string UsrInventoryLookup { get; set; }

public abstract class usrInventoryLookup : PX.Data.BQL.BqlString.Field<usrInventoryLookup> { }
}

Hope this work’s


idrusm52
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Answer
  • June 3, 2025

Thank you ​@Saikrishna V & ​@Nilkanth Dipak 

After check with GPT, I got the update code as below that working well.

using PX.Data;
using PX.Data.BQL;
using PX.Objects.IN;
using PX.Objects.PO;

namespace PX.Objects.PO
{
public class InventoryItemExt : PXCacheExtension<InventoryItem>
{
[PXDBString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Lookup Code")]
public string UsrLookup { get; set; }

public abstract class usrLookup : PX.Data.BQL.BqlString.Field<usrLookup> { }
}
public class POLineExtCustom : PXCacheExtension<POLine>
{
[PXString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Part No.", Enabled = false)]
[PXUnboundDefault(typeof(
Search<InventoryItemExt.usrLookup,
Where<InventoryItem.inventoryID, Equal<Current<POLine.inventoryID>>>>))]
[PXFormula(typeof(Default<POLine.inventoryID>))]
public string UsrInventoryLookup { get; set; }

public abstract class usrInventoryLookup : BqlString.Field<usrInventoryLookup> { }
}
}

 


DipakNilkanth
Pro III
Forum|alt.badge.img+13

@idrusm52, Thanks for sharing!