Question

Create a new column in Customer's payment method

  • 9 January 2024
  • 6 replies
  • 98 views

Userlevel 1

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

Userlevel 5
Badge +1

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

Userlevel 7
Badge +12

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,

Userlevel 7
Badge +17

@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.

 

Userlevel 1

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
   }

Userlevel 7
Badge

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

Userlevel 4
Badge +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.

 

 

 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved