Added a new column in Customer’s payment method “Is Autopay” column checkbox type. But it seems its not saving when I try to checked one the save when I reload it’s not checked.
Before reload
After reload
Added a new column in Customer’s payment method “Is Autopay” column checkbox type. But it seems its not saving when I try to checked one the save when I reload it’s not checked.
Before reload
After reload
Hi
Have you assigned PXDBBool attribute to your custom field?
Also have you checked in the database that field is actually saving in the database table?
If possible, could you provide the custom field code?
Regards,
Sagar
I dont believe this is very easy as the CustomerPaymentMethodInfo is a projection so not a real DAC/Table. As
Below is the info from help documents.
This is the source code for the payment method.
public class CustomerPaymentMethodInfoExt : PXCacheExtension<PX.Objects.AR.CustomerPaymentMethodInfo>
{
#region UsrIsAutopay
public abstract class usrIsAutopay : BqlType<IBqlBool, bool>.Field<usrIsAutopay> { }
//[PXDBBool]
[PXDBBool(BqlField = typeof(CustomerPaymentMethodExt.usrIsAutopay))]
[PXUIField(DisplayName = "Is Autopay")]
//[PXDBDefault(typeof(CustomerPaymentMethodExt.usrIsAutopay), PersistingCheck = PXPersistingCheck.Nothing)]
//[PXParent(typeof(Select<CustomerPaymentMethod, Where<CustomerPaymentMethod.pMInstanceID, Equal<Current<CustomerPaymentMethodInfo.pMInstanceID>>>>))]
//[PXDBDefault(typeof(Search<CustomerPaymentMethodExt.usrIsAutopay, Where<CustomerPaymentMethod.pMInstanceID, Equal<Current<CustomerPaymentMethodInfo.pMInstanceID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual bool? UsrIsAutopay { get; set; }
#endregion
}
Looking through the source, This DAC updates differnetly than most.The persisting event cancels and is handled by a custom persisting event that creates the default payment method. See below:
protected virtual void _(Events.RowPersisting<CustomerPaymentMethodInfo> e)
{
e.Cancel = true;
}
#endregion
[PXOverride]
public virtual void Persist(Action del)
{
using (PXTransactionScope ts = new PXTransactionScope())
{
//assuming only one instance of CustomerPaymentMethodC could be inserted at a time
if (DefPaymentMethodInstance.Cache.Inserted.Count() > 0)
{
IEnumerator cpmEnumerator = DefPaymentMethodInstance.Cache.Inserted.GetEnumerator();
if (cpmEnumerator.MoveNext())
{
CustomerPaymentMethod current = cpmEnumerator.Current as CustomerPaymentMethod;
if (current != null && CCProcessingHelper.IsTokenizedPaymentMethod(Base, current.PMInstanceID))
{
var graph = PXGraph.CreateInstance<CCCustomerInformationManagerGraph>();
ICCPaymentProfileAdapter paymentProfile = new GenericCCPaymentProfileAdapter<CustomerPaymentMethod>(DefPaymentMethodInstance);
ICCPaymentProfileDetailAdapter profileDetail = new GenericCCPaymentProfileDetailAdapter<CustomerPaymentMethodDetail, PaymentMethodDetail>(DefPaymentMethodInstanceDetailsAll, PMDetails);
graph.GetOrCreatePaymentProfile(Base, paymentProfile, profileDetail);
}
}
}
del();
ts.Complete();
}
}
Due to the rest of the screen being read only, it would be easiest to have the field be changed on the customer payment method screen, and then on the customer screen, show the value.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.