Reputation: 95
I am attempting to add a usrfield from POOrderExt to the grid on SOOrderEntry->POLink. I tried to add a new field through the customizer (it attempted to create the field in Data Class: SO.POLine3).
[PXDBDate(BqlField = typeof(POOrderExt.usrFactDate))]
[PXUIField(DisplayName = "Factory Confirmed", Enabled = false)]
it fails, I recognize this is technically equivalent to a SQL view due to the PXProjection so it won't have a dedicated DAC. Is there a way I can append the POLine3 implementation to include my extension class, or do I have to create an entirely new serializable and change the grids Datamember?
Edit: I have implemented the Dac extension
namespace PX.Objects.SO{
public class POLine3Ext: PXCacheExtension<PX.Objects.SO.POLine3>{
#region UsrCustomField
[PXString][PXUIField(DisplayName="Custom Field")]
public virtual string UsrCustomField{get;set;}
public abstract class usrCustomField : IBqlField{}
#endregion
#region UsrFactoryConfirmedDate
[PXDBDate]
[PXUIField(DisplayName = "FactoryConfirmedDate")]
public virtual DateTime? UsrFactoryConfirmedDate { get; set; }
public abstract class usrFactoryConfirmedDate : IBqlField { }
#endregion
}}
Here is my field defaulting event for my user field
protected virtual void POLine3_UsrFactoryConfirmedDate_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
{
POLine3 row = (POLine3)e.Row;
if (row == null) return;
POLine3Ext rowE = PXCache<POLine3>.GetExtension<POLine3Ext>(row);
POOrder pRow = PXSelect<POOrder, Where<POOrder.orderNbr, Equal<Required<POLine3.orderNbr>>>>
.Select(Base, row.OrderNbr);
POOrderExt pRowExt = PXCache<POOrder>.GetExtension<POOrderExt>(pRow);
if (pRow == null) return;
e.NewValue = pRowExt.UsrFactoryConfirmedDate;
e.Cancel = true;
}
As I have mentioned in the comment below in Hybriddzz post, there is a operand data type null is invalid for max operator when i create the PXDBDate field. It won't let me open the POLink action to view the grid.
Upvotes: 0
Views: 220
Reputation: 1864
You can write an extension yourself for the DAC POLine3.
Refer to the HELP > Customization > Examples of Func Customization > Adding Data Fields > Adding a Data Field From Code
Adding a Data Field From Code
If you work with the customization code in MS Visual Studio, you can define a new data field in DAC extension code and then create the control on the form.
Upvotes: 1