I’m trying to change the default doc type value of “payment” to “Prepayment” in payments and application screen.
I have tried to use cache attached method, field defaulting and row selected events to override the default value in the graph, but those are not working to change default value of Doc Type.
I have tried below code. Can anyone point me in the right direction to set the doc type value to prepayment.
public class ARPaymentEntry_Extension : PXGraphExtension<ARPaymentEntry>
{
//1st method
#region Using Cached attached
[PXMergeAttributes(Method = MergeMethod.Append)]
//[PXRemoveBaseAttribute(typeof(ARPaymentType.ListExAttribute))]
[PXRemoveBaseAttribute(typeof(ARPaymentType.ListAttribute))]
//[PXRemoveBaseAttribute(typeof(ARDocType.ListAttribute))]
[PXDefault(ARPaymentType.Prepayment)]
[NewARListAttribute]
// [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
//[PXFieldDescription]
protected virtual void ARPayment_DocType_CacheAttached(PXCache sender)
{
}
public new class NewARListAttribute : PXStringListAttribute
{
public NewARListAttribute()
: base(
new string[] { ARPaymentType.Prepayment, ARPaymentType.Payment, ARPaymentType.CreditMemo, ARPaymentType.Refund, ARPaymentType.VoidRefund, ARPaymentType.VoidPayment, ARPaymentType.SmallBalanceWO },
new string[] { Messages.Prepayment, Messages.Payment, Messages.CreditMemo, Messages.Refund, Messages.VoidRefund, Messages.VoidPayment, Messages.SmallBalanceWO })
{ }
}
#endregion
//////[PXMergeAttributes(Method = MergeMethod.Append)]
//////[PXRemoveBaseAttribute(typeof(ARPaymentType.ListExAttribute))]
//////[PXDefault(ARDocType.Prepayment)]
//////[XMSListAttribute]
//////protected virtual void ARRegister_DocType_CacheAttached(PXCache sender)
//////{
//////}
//2nd
#region Using setdefault in row selected event
//protected virtual void ARPayment_RowSelected(PXCache cache, PXRowSelectedEventArgs e,PXRowSelected baseEvent)
//{
// baseEvent?.Invoke(cache, e);
// PXDefaultAttribute.SetDefault<ARPayment.docType>(cache, ARPaymentType.Prepayment);
//}
#endregion
//3rd
#region Using field defaulting event
//public virtual void ARPayment_DocType_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
//{
// e.NewValue = "PPM";
//}
#endregion
}
Thanks in advance.