Hello Acumatica Community,
i am trying to add the attributes of a stock item to the PO Line in the Details Tab
These Attributes:
For my problem i found this post:
- I thought i could transfer that to the PO and add the inventory attributes to the Details Tab.
- After 2 very long days and suffering i no longer know what to do.
- I would like you to take a look into the code of my customization.
- I added a new custom field in POLine which i believe later stores the value of the specific attribute. But i am not sure if i correctly defined which attribute to show.
Here is my Code for the DAC Extension of POLine:
using PX.Common;
using PX.Data.BQL;
using PX.Data.ReferentialIntegrity.Attributes;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.CM.Extensions;
using PX.Objects.Common.Bql;
using PX.Objects.Common.Discount.Attributes;
using PX.Objects.Common.Discount;
using PX.Objects.Common;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.GL;
using PX.Objects.IN.Matrix.Interfaces;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PX.Objects.TX;
using PX.Objects;
using System.Collections.Generic;
using System;
namespace PX.Objects.PO
{
public class POLineExt : PXCacheExtension<PX.Objects.PO.POLine>
{
#region UsrAttribute1
PXDBString(512, IsUnicode = true)]
PXUIField(DisplayName = "MATCHCODE")]
public virtual string UsrAttribute1 { get; set; }
public abstract class usrAttribute1 : BqlString.Field<usrAttribute1> { }
#endregion
}
}
And here for the Graph Extension POOrderEntry
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Objects.GL;
using PX.Objects.CM.Extensions;
using PX.Objects.CS;
using PX.Objects.CR;
using PX.Objects.TX;
using PX.Objects.IN;
using PX.Objects.EP;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.SO;
using SOOrder = PX.Objects.SO.SOOrder;
using SOLine = PX.Objects.SO.SOLine;
using PX.Data.DependencyInjection;
using PX.Data.ReferentialIntegrity.Attributes;
using PX.LicensePolicy;
using PX.Objects.PM;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AP.MigrationMode;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Data.BQL.Fluent;
using PX.Data.BQL;
using PX.Objects.Common.Bql;
using PX.Objects.Extensions.CostAccrual;
using PX.Objects.DR;
using PX.Data.WorkflowAPI;
using PX.Objects.Extensions;
using PX.Objects.Common.DAC;
using PX.Objects.Common.Scopes;
using PX.Objects.IN.Services;
using PX.Objects.Extensions.MultiCurrency;
using PX.Data.Description;
using PX.Objects;
using PX.Objects.PO;
namespace PX.Objects.PO
{
public class POOrderEntry_Extension : PXGraphExtension<PX.Objects.PO.POOrderEntry>
{
#region Event Handlers
protected virtual void POLine_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(sender, e);
POLine row = (POLine)e.Row;
if (row == null) return;
CSAnswers CSAns = PXSelectJoin<CSAnswers,
InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>,
Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>,
And<CSAnswers.attributeID, Equal<Required<CSAnswers.attributeID>>
>>>.Select(Base, row.InventoryID, "MATCHCODE");
if (CSAns != null)
{
POLineExt rowExt = row.GetExtension<POLineExt>();
rowExt.UsrAttribute1 = CSAns.Value;
}
}
}
#endregion
}
Case 1: In POOrderEntry with this:
rowExt.UsrAttribute1 = CSAns.Value;
The compiler shows no error but when i try to open a PO the system gives the error “Invalid column name aPOLine].nUsrAttribute1]”
Case 2: In POOrderEntry with this:
rowExt.usrAttribute1 = CSAns.Value;
The following error appears:
\App_RuntimeCode\POOrderEntry.cs(60): error CS0572: 'usrAttribute1': cannot reference a type through an expression; try 'POLineExt.usrAttribute1' instead
\App_RuntimeCode\POOrderEntry.cs(60): error CS0118: 'POLineExt.usrAttribute1' is a type but is used like a variable
\App_RuntimeCode\POOrderEntry.cs(60): error CS0572: 'usrAttribute1': cannot reference a type through an expression; try 'POLineExt.usrAttribute1' instead
I would be so grateful for any help! Thanks to anyone who reads this and tries to help me!