Trace Log: 7/26/2023 1:09:54 PM Error: Specified cast is not valid.
at _SetValueByOrdinal(RCContractPayment , Int32 , Object , PXCacheExtension[] )
at PX.Data.PXCache1.SetValue(Object data, Int32 ordinal, Object value) at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation) at PX.Data.PXCache
1.PersistInserted(Object row, Boolean bypassInterceptor)
at PX.Data.PXCache1.Persist(PXDBOperation operation) at PX.Data.PXGraph.Persist() at PX.Data.PXSave
1.d__2.MoveNext()
at PX.Data.PXAction1.d__38.MoveNext() at PX.Data.PXAction
1.d__38.MoveNext()
at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows)
at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments)
DAC:
[Serializable]
[PXCacheName("RCContractPayment")]
public class RCContractPayment : IBqlTable
{
#region ContractID
[RoyaltyContract(IsKey = true)]
[PXDBDefault(typeof(RCContract.contractID))]
[PXParent(typeof(SelectFrom<RCContract>.
Where<RCContract.contractID.
IsEqual<RCContractPayment.contractID.FromCurrent>>))]
public virtual int? ContractID { get; set; }
public abstract class contractID : PX.Data.BQL.BqlInt.Field<contractID> { }
#endregion
#region LineNbr
[PXDBInt(IsKey = true)]
[PXDefault]
[PXLineNbr(typeof(RCContract.paymentLineCntr))]
[PXUIField(DisplayName = "Line Nbr")]
public virtual int? LineNbr { get; set; }
public abstract class lineNbr : PX.Data.BQL.BqlInt.Field<lineNbr> { }
#endregion
#region PaymentType
[PXDBString(1, IsFixed = true, InputMask = "")]
[PXDefault()]
[PXUIField(DisplayName = "Payment Type")]
[PXStringList(
new string[]
{
Constants.ContractPaymentTypeConstants.Bonus,
Constants.ContractPaymentTypeConstants.Contract,
Constants.ContractPaymentTypeConstants.RoyaltyPrepayment
},
new string[]
{
Constants.RoyaltyContractMessages.Bonus,
Constants.RoyaltyContractMessages.Contract,
Constants.RoyaltyContractMessages.RoyaltyPrepayment
})]
public virtual string PaymentType { get; set; }
public abstract class paymentType : PX.Data.BQL.BqlString.Field<paymentType> { }
#endregion
#region PaymentClassification
[PXDBString(1, IsFixed = true, InputMask = "")]
[PXUIField(DisplayName = "Payment Classification")]
[PXStringList(
new string[]
{
Constants.ContractPaymentClassificationConstants.DownPayment,
Constants.ContractPaymentClassificationConstants.FinalPayment
},
new string[]
{
Constants.RoyaltyContractMessages.DownPayment,
Constants.RoyaltyContractMessages.FinalPayment
})]
public virtual string PaymentClassification { get; set; }
public abstract class paymentClassification : PX.Data.BQL.BqlString.Field<paymentClassification> { }
#endregion
#region PaymentAmount
[PXDBDecimal()]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIVerify(typeof(Where<RCContractPayment.paymentAmount, GreaterEqual<decimal0>>), PXErrorLevel.Error, RoyaltyContractMessages.PaymentAmountMustBePositive)]
[PXUIField(DisplayName = "Payment Amount")]
public virtual Decimal? PaymentAmount { get; set; }
public abstract class paymentAmount : PX.Data.BQL.BqlDecimal.Field<paymentAmount> { }
#endregion
#region PaymentTrigger
[PXDBString(1, IsFixed = true, InputMask = "")]
[PXUIField(DisplayName = "Payment Trigger")]
[RCContractPaymentTriggerTypeListAttribute.List]
public virtual string PaymentTrigger { get; set; }
public abstract class paymentTrigger : PX.Data.BQL.BqlString.Field<paymentTrigger> { }
#endregion
#region EstimatedTriggerDate
[PXDBDate()]
[PXUIField(DisplayName = "Estimated Trigger Date")]
public virtual DateTime? EstimatedTriggerDate { get; set; }
public abstract class estimatedTriggerDate : PX.Data.BQL.BqlDateTime.Field<estimatedTriggerDate> { }
#endregion
#region TriggerSalesAmount
[PXDBDecimal()]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIVerify(typeof(Where<RCContractPayment.triggerSalesAmount, GreaterEqual<decimal0>>), PXErrorLevel.Error, RoyaltyContractMessages.TriggerSalesAmountMustBePositive)]
[PXUIField(DisplayName = "Trigger Sales Amount")]
public virtual Decimal? TriggerSalesAmount { get; set; }
public abstract class triggerSalesAmount : PX.Data.BQL.BqlDecimal.Field<triggerSalesAmount> { }
#endregion
#region TriggerSalesUnits
[PXDBInt()]
[PXDefault(0)]
[PXUIVerify(typeof(Where<RCContractPayment.triggerSalesUnits, GreaterEqual<Zero>>), PXErrorLevel.Error, RoyaltyContractMessages.TriggerSalesUnitsMustBePositive)]
[PXUIField(DisplayName = "Trigger Sales Units")]
public virtual int? TriggerSalesUnits { get; set; }
public abstract class triggerSalesUnits : PX.Data.BQL.BqlInt.Field<triggerSalesUnits> { }
#endregion
#region TriggerDate
[PXDBDate()]
[PXUIField(DisplayName = "Trigger Date")]
public virtual DateTime? TriggerDate { get; set; }
public abstract class triggerDate : PX.Data.BQL.BqlDateTime.Field<triggerDate> { }
#endregion
#region TriggerAfterDays
[PXDBInt()]
[PXDefault(0)]
[PXUIVerify(typeof(Where<RCContractPayment.triggerAfterDays, GreaterEqual<Zero>>), PXErrorLevel.Error, RoyaltyContractMessages.TriggerAfterDaysMustBePositive)]
[PXUIField(DisplayName = "Trigger After Days")]
public virtual int? TriggerAfterDays { get; set; }
public abstract class triggerAfterDays : PX.Data.BQL.BqlInt.Field<triggerAfterDays> { }
#endregion
#region DueDate
[PXDBDate()]
[PXUIField(DisplayName = "Due Date")]
public virtual DateTime? DueDate { get; set; }
public abstract class dueDate : PX.Data.BQL.BqlDateTime.Field<dueDate> { }
#endregion
#region APProcessed
[PXDefault(false)]
[PXDBBool()]
[PXUIField(DisplayName = "Payables Processed", TabOrder = -1, IsReadOnly = true)]
public virtual bool? APProcessed { get; set; }
public abstract class aPProcessed : PX.Data.BQL.BqlBool.Field<aPProcessed> { }
#endregion
#region ContractPaymentBatchID
[PXDBInt()]
[PXUIField(DisplayName = "Royalty Batch ID", IsReadOnly = true)]
public virtual int? ContractPaymentBatchID { get; set; }
public abstract class contractPaymentBatchID : PX.Data.BQL.BqlInt.Field<contractPaymentBatchID>
{
}
#endregion
#region CreatedByID
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID> { }
#endregion
#region CreatedByScreenID
[PXDBCreatedByScreenID()]
public virtual string CreatedByScreenID { get; set; }
public abstract class createdByScreenID : PX.Data.BQL.BqlString.Field<createdByScreenID> { }
#endregion
#region CreatedDateTime
[PXDBCreatedDateTime()]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : PX.Data.BQL.BqlDateTime.Field<createdDateTime> { }
#endregion
#region LastModifiedByID
[PXDBLastModifiedByID()]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : PX.Data.BQL.BqlGuid.Field<lastModifiedByID> { }
#endregion
#region LastModifiedByScreenID
[PXDBLastModifiedByScreenID()]
public virtual string LastModifiedByScreenID { get; set; }
public abstract class lastModifiedByScreenID : PX.Data.BQL.BqlString.Field<lastModifiedByScreenID> { }
#endregion
#region LastModifiedDateTime
[PXDBLastModifiedDateTime()]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }
#endregion
#region Tstamp
[PXDBTimestamp()]
public virtual byte[] Tstamp { get; set; }
public abstract class tstamp : PX.Data.BQL.BqlByteArray.Field<tstamp> { }
#endregion
Any ideas where to even start looking?
The error ended up being the custom attribute that we were using, once I commented out all of the PXDefault's the underlying error revealed itself. So once I added back the PXDefault's and removed the custom attribute everything worked as expected.