Create Payment Proc


Hello everybody,

today I want to write a few words about method CreatePaymentProc in graph SOOrderEntry.

Among different features of this method, want to describe that it have for some reason out parameter! Take a look on it's declaration:

public virtual void CreatePaymentProc(SOOrder orderout PXGraph targetstring paymentType = ARPaymentType.Payment)


as you see, it accepts as a parameter PXGraph. Inside of open part of Acumatica source code there is only one more file, which has similar staff: ServiceOrderCore. Take a look on it:

public static void CreatePrepayment(FSServiceOrder fsServiceOrderRowFSAppointment fsAppointmentRowout PXGraph targetstring paymentType = ARPaymentType.Payment)

But similarities not finished. Take notice how those methods utilize PXGraph target. First goes ServiceOrderCore:

ARPaymentEntry graphARPaymentEntry = PXGraph.CreateInstance<ARPaymentEntry>();
target = graphARPaymentEntry;

And second one goes SOOrderEntry:

public virtual void CreatePaymentProc(SOOrder orderout PXGraph targetstring paymentType = ARPaymentType.Payment)
	ARPaymentEntry docgraph = PXGraph.CreateInstance<ARPaymentEntry>();
	target = docgraph;

And now you'd probably ask, and so what? How can I use it? One of the very useful ways would be getting graph of ARPaymentEntry after calling of the method. 

In one of my projects it was needed to call method CreatePaymentProc, and persisting of payment but without showing dialog window of creation of Payment. Below goes code how I've achieved it:

PXLongOperation.StartOperation(Base, delegate()
    PXGraph target;
    Base.CreatePaymentProc(Base.Document.Current, out target);
    var arPaymentEntry = target as ARPaymentEntry;
    //here some additional manipulations may be added to in memory created payment


If you have a need to call method CreatePaymentProc, and then massage data after execution of that method, jast ignore showing pop up window and with help of type casting and additional changes make it. Afterwards call Persist.


Comments are closed