Hello,
I would like to know how I can display the Alternate ID in the Invoice detail grid.
Could you please guide me on how to achieve this?
Hello,
I would like to know how I can display the Alternate ID in the Invoice detail grid.
Could you please guide me on how to achieve this?
Best answer by svwk05
If you want to display the Alternate ID in the Invoice Detail grid:
First, create a custom field in the DAC (e.g., UsrAlternateID). Then, use the FieldSelecting event in the graph to fetch and assign the corresponding Alternate ID for the selected Inventory Item.
This will allow the value to be shown dynamically in the UI. Below is the sample code.
In DAC
#region UsrAlternateID
[PXString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Alternate ID", Enabled = false)]
public virtual string UsrAlternateID { get; set; }
public abstract class usrAlternateID : PX.Data.BQL.BqlString.Field<usrAlternateID> { }
#endregionIn GraphExtension
protected void ARTran_UsrAlternateID_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
var row = (ARTran)e.Row;
if (row?.InventoryID == null || Base.Document.Current?.CustomerID == null)
return;
var altID = PXSelectJoin<INItemXRef,
InnerJoin<InventoryItem, On<INItemXRef.inventoryID, Equal<InventoryItem.inventoryID>>>,
Where<INItemXRef.inventoryID, Equal<Required<INItemXRef.inventoryID>>,
And<INItemXRef.bAccountID, Equal<Required<INItemXRef.bAccountID>>>>>
.Select(Base, row.InventoryID, Base.Document.Current.CustomerID)
.RowCast<INItemXRef>()
.FirstOrDefault();
if (altID != null)
{
e.ReturnValue = altID.AlternateID;
}
}
Hope this helps!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.