I have a custom DAC, 'BranchPaymentDefault.' One of the fields is a lookup to the 'Account' object.
Whenever I open the page, or try to use the selector to select an Account, I get an error saying 'Specified Cast Not Valid
I tried using the PXSelector attribute instead of Account attribute, but I get the same error.
DAC
namespace VendorMasterPaymentDefaults
{
[Serializable] public class BranchPaymentDefault : IBqlTable {
[PXDBInt(IsKey = true)]
[PXDefault()]
[PXUIField(DisplayName = "Branch")]
[Branch()]
public virtual Int32? BranchID { get; set; }
public abstract class branchID : IBqlField { }
[PXDBInt(IsKey = true)]
[PXDefault(typeof(Vendor.bAccountID))]
[PXUIField(DisplayName = "Vendor")]
[PXParent(typeof(Select<Vendor, Where<Vendor.bAccountID, Equal<Current<BranchPaymentDefault.vendorID>>>>))]
public virtual Int32? VendorID { get; set; }
public abstract class vendorID : IBqlField { }
[Account(typeof(Account.accountID), IsKey = false, DisplayName = "Account")]
public virtual int? AccountID { get; set; }
public abstract class accountID : IBqlField { }
[PXDBDecimal]
[PXDefault()]
[PXUIField(DisplayName = "Allotment Amt")]
public virtual decimal? AllotmentAmt { get; set; }
public abstract class allotmentAmt : IBqlField { }
[PXDBString(IsUnicode = true)]
[PXUIField(DisplayName = "Allotment Type")]
[PXDefault(allotmentType.Values.Percentage)]
[PXStringList(new string[]{ allotmentType.Values.Percentage, allotmentType.Values.FixedAmt },
new string[]{ allotmentType.Values.UI.Percentage, allotmentType.Values.UI.FixedAmt })]
public virtual string AllotmentType { get; set; }
public abstract class allotmentType : IBqlField
{
public class Values
{
public const string Percentage = "PCT";
public const string FixedAmt = "FIX";
public class UI
{
public const string Percentage = "Percent";
public const string FixedAmt = "Fixed";
}
}
}
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : IBqlField { }
[PXDBCreatedDateTime]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : IBqlField { }
[PXDBLastModifiedByID]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : IBqlField { }
[PXDBLastModifiedDateTime]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : IBqlField { }
} }
GRAPH
namespace PX.Objects.AP
{
public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
public PXSelect<BranchPaymentDefault,
Where<BranchPaymentDefault.vendorID,
Equal<Current<BAccount.bAccountID>>>> BranchPaymentDefaults;
}
}