Skip to main content
Question

Create a new column in Customer's payment method

  • January 9, 2024
  • 6 replies
  • 129 views

Forum|alt.badge.img

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

 

6 replies

Sagar Greytrix
Captain II
Forum|alt.badge.img+3

Hi @melvinc,

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


dcomerford
Captain II
Forum|alt.badge.img+15
  • Captain II
  • January 31, 2024

I dont believe this is very easy as the CustomerPaymentMethodInfo is a projection so not a real DAC/Table. As @sagar07 says can you share your code/package,


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • February 2, 2024

@melvinc  As it is a project DAC, hope you have extended the right projection DAC and made the BQLField relation to the actual field? Please let us know if you need any assistance. 

 

Below is the info from help documents.

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • February 5, 2024

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
   }


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • March 26, 2024

Hi @melvinc were you able to find a solution? Thank you!


Keith Richardson
Semi-Pro I
Forum|alt.badge.img+2

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.