Skip to main content
Answer

The GetProcessDelegate does not work in version 2022 R2

  • January 27, 2023
  • 7 replies
  • 213 views

Forum|alt.badge.img

Hi guys, I have a small problem, the GetProcessDelegate method works in the old version, but in this new version it doesn't give an error.

here is the code.

protected void PrintChecksFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
        {

            var row = (PrintChecksFilter)e.Row;

            if (row == null)
                return;

            if (del != null)
                del(sender, e);
            var processDelegate = (PXProcessingBase<APPayment>.ProcessListDelegate)Base.APPaymentList.GetProcessDelegate();
        }

Best answer by Shawn Burt

try this for getting the process delegate.

its not technically supported by acumatica but I think its your only option here

 

            var processDelegate = (PXProcessingBase<APAdjust>.ProcessListDelegate)Base.APDocumentList.GetType().GetProperty("ProcessDelegate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Base.APDocumentList);

 

7 replies

Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • January 27, 2023

What graph are you extending?

I just tried this and its working fine. I assume APPrintChecks based on the row override.


Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • January 27, 2023

sorry was being special and misread the version I was testing in. I was in 21R2 and looking at 22R2 now, it seems that the code for GetProcessDelegate is no longer present. I am looking to see if there is an alternative. Sorry for the confusion.


Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • January 27, 2023

Forum|alt.badge.img
  • Author
  • Freshman II
  • January 27, 2023

What graph are you extending?

I just tried this and its working fine. I assume APPrintChecks based on the row override.

 

I am extending: APPrintChecks_Extension

protected void PrintChecksFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
        {
            var row = (PrintChecksFilter)e.Row;
            if (row == null) return;
            if (del != null) del(sender, e);
            var processDelegate = (PXProcessingBase<APAdjust>.ProcessListDelegate)Base.APDocumentList.GetProcessDelegate();
            Base.APDocumentList.SetProcessDelegate(delegate (List<APAdjust> apDocs)
            {
                MethodsTest(apDocs, processDelegate);//here my code
            });
        }


Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • January 27, 2023

can I see code for MethodTest,

trying to see if there is an alternative way to infer the process delegate as Acumatica has deprecated the official way to get it.


Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • Answer
  • January 27, 2023

try this for getting the process delegate.

its not technically supported by acumatica but I think its your only option here

 

            var processDelegate = (PXProcessingBase<APAdjust>.ProcessListDelegate)Base.APDocumentList.GetType().GetProperty("ProcessDelegate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Base.APDocumentList);

 


Forum|alt.badge.img
  • Author
  • Freshman II
  • January 27, 2023

can I see code for MethodTest,

trying to see if there is an alternative way to infer the process delegate as Acumatica has deprecated the official way to get it.

here is my code:

 

 public virtual void MethodsTest(List<APPayment> apDocs, PXProcessingBase<APPayment>.ProcessListDelegate processDelegate)
        {
            PXGraph.InstanceCreated.AddHandler<APPaymentEntry>((apgraph) =>
           apgraph.RowUpdated.AddHandler<APPayment>((c, e) =>
           {
               var app = (APPayment)e.Row;
               var api = app.GetExtension<xtAPPayment>();

               PrintChecksFilter pch = Base.Filter.Current;
               var pchExt = pch.GetExtension<PrintChecksFilterExt>();
               if (app != null && pchExt != null)
               {
                   api.TMedioPago = pchExt.UsrTMedioPago;
               }
           }));
            if (processDelegate != null)
                processDelegate(apDocs);
        }