Solved

How to Override CreatePaymentExt -> GetRequiredPrepaymentEnabled

  • 14 June 2024
  • 4 replies
  • 39 views

Userlevel 3
Badge +1

I’m trying to override the GetRequiredPrepaymentEnabled method on the CreatePaymentExt graph extension.

I’ve multiple methods, but have not been able to get it to work so far. 

Heres a screenshot showing ,my latest attempt. 

 

icon

Best answer by aaghaei 15 June 2024, 08:57

View original

4 replies

Userlevel 7
Badge +9

@scottstanaland12  try this in you graph extension

[PXProtectedAccess()]
protected abstract bool GetRequiredPrepaymentEnabled(SOOrder order);

public delegate bool GetRequiredPrepaymentEnabledDelegate(SOOrder order);

[PXOverride]
public virtual bool GetRequiredPrepaymentEnabled(SOOrder order, GetRequiredPrepaymentEnabledDelegate baseMethod)
{
// Do some stuff
bool bm = baseMethod?.Invoke(order); // Do not call the base method if you do not need it
// Do more stuff and return the result
}

 

Userlevel 3
Badge +1

aaghaei, that worked.

Thanks for your help.

 

@scottstanaland12  try this in you graph extension

[PXProtectedAccess()]
protected abstract bool GetRequiredPrepaymentEnabled(SOOrder order);

public delegate bool GetRequiredPrepaymentEnabledDelegate(SOOrder order);

[PXOverride]
public virtual bool GetRequiredPrepaymentEnabled(SOOrder order, GetRequiredPrepaymentEnabledDelegate baseMethod)
{
// Do some stuff
bool bm = baseMethod?.Invoke(order); // Do not call the base method if you do not need it
// Do more stuff and return the result
}

 

 

Userlevel 3
Badge +1

@aaghaei The next thing I’m running into is I need to override the SatisfyPrepaymentRequirements and ViolatePrepaymentRequirements methods, which are Exteinsion methods on the SOOrder DAC class. 

I’ve tried adding the extension methods to my SOOrder DAC extension, but I have not been able to get it to call my customized methods.  Any ideas?

 

Userlevel 7
Badge +9

@scottstanaland12 Sorry, I am out of town without my computer. I suggest create a new topic so others can assist and also I suggest instead of screenshots attach your code so people don’t have to redo the work you have already done.

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