I completed the T210 course and proceeded to apply it to a real world use case where I need multiple custom fields attached to a specific class of Customer. Rather than the user field approach, which will enhance Business Account and extend those fields to all related entities using the shared DB table, I want to use a custom table to limit the storage to Customers only. It doesn’t seem to work on Insert though. Is there something additional that needs to be done to insert a new record in a custom table from a graph extension? I don’t remember doing that in T210 for the custom tab on the Stock Items screen. I have the PXDBDefault and PXParent attributes assigned. Aren’t they supposed to facilitate insertion as well as other operations? On Create, with an explicitly assigned Customer code, I get the error “BAccountID can’t be null”, but if I manually insert a record from SSMS after create, everything works fine.
What did I miss? Thanks.
Here is the start of the DAC definition:
using System;
using PX.Data;
using PX.Data.BQL;
using PX.Data.BQL.Fluent;
using PX.Objects.AR;
namespace CustomerDealerExtended
{
[PXCacheName(Messages.ZZCustomerDealerExt)]
public class ZZCustomerDealerExt : PXBqlTable, IBqlTable
{
#region BAccountID
[PXDBInt(IsKey = true)]
[PXDBDefault(typeof(Customer.bAccountID))]
[PXParent(typeof(SelectFrom<Customer>.Where<Customer.bAccountID.
IsEqual<ZZCustomerDealerExt.bAccountID.FromCurrent>>))]
public virtual int? BAccountID { get; set; }
public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
#endregion
...
}
Here is the start of the graph extension:
using PX.Data;
using PX.Data.BQL.Fluent;
using CustomerDealerExtended;
namespace PX.Objects.AR
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class CustomerMaintExt : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
#region Data Views
public SelectFrom<ZZCustomerDealerExt>.Where<ZZCustomerDealerExt.bAccountID.
IsEqual<Customer.bAccountID.FromCurrent>>.View CustomerDealerExt = null!;
#endregion