Skip to main content
Solved

Trying to capture price list update in customer screen

  • December 12, 2024
  • 3 replies
  • 67 views

Forum|alt.badge.img
  • Jr Varsity III
  • 10 replies

I’m trying to capture the update in price class when changing it in customer. I can capture the customer updating in persist method but I can’t capture the new price class value only the old one. I need to capture both the oldvalue of the price class and the new one.
 



 

Best answer by stephenward03

Hi ​@jmc37,

You could use the following to get the new ID value in the Persist method. Just tested and it worked for me, so I hope it works for you too. 

using PX.Data;
using static PX.Objects.AR.CustomerMaint;
namespace PX.Objects.AR
{
    public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
    {
        public static bool IsActive() => true;

        public delegate void PersistDelegate();
        [PXOverride]
        public void Persist(PersistDelegate baseMethod)
        {
            var cPriceClassID =  Base.GetExtension<DefLocationExt>().DefLocation.Current.CPriceClassID;
            baseMethod();
        }
    }
}

 

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+1
  • Jr Varsity I
  • 62 replies
  • December 13, 2024

Hi ​@jmc37 ,

To capture both the old and new values of the Price Class field when it's updated in the Customer screen, you can use either the FieldUpdated event handler or Persist.

You need to create one more custom field for capturing old value.

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 10 replies
  • December 13, 2024
noorula77 wrote:

Hi ​@jmc37 ,

To capture both the old and new values of the Price Class field when it's updated in the Customer screen, you can use either the FieldUpdated event handler or Persist.

You need to create one more custom field for capturing old value.

 

Those only retrieve the old fields. For the customer screen it isn’t working for getting the new value.


Forum|alt.badge.img+1
  • Varsity I
  • 93 replies
  • Answer
  • December 16, 2024

Hi ​@jmc37,

You could use the following to get the new ID value in the Persist method. Just tested and it worked for me, so I hope it works for you too. 

using PX.Data;
using static PX.Objects.AR.CustomerMaint;
namespace PX.Objects.AR
{
    public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
    {
        public static bool IsActive() => true;

        public delegate void PersistDelegate();
        [PXOverride]
        public void Persist(PersistDelegate baseMethod)
        {
            var cPriceClassID =  Base.GetExtension<DefLocationExt>().DefLocation.Current.CPriceClassID;
            baseMethod();
        }
    }
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings