Skip to main content
Answer

How to retrieve values from Postman Request in C# code?

  • January 19, 2024
  • 1 reply
  • 97 views

 
I have created a custom button "Custom Create Payment". This custom button triggers another standard Acumatica button "Create Payment" which opens a popup window. I want to use Postman Request to change the data in the popup window. Here is the postman request 
 

Web service endpoints:

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public static bool IsActive() => true;

public PXAction<SOOrder> customCreatePayment;

[PXButton]
[PXUIField(DisplayName = "Custom Create Payment", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual void CustomCreatePayment()
{
using (new PXTransactionScope())
{
var GraphExt = Base.GetExtension<CreatePaymentExt>();
try
{
GraphExt.createDocumentPayment.Press();
}
catch (PXException ex)
{

}

var values = GraphExt.QuickPayment.Current;

values.CuryOrigDocAmt = 500;
values.OrigDocAmt = 500;
var Paymentgraph = GraphExt.CreatePayment(values, Base.Document.Current, ARPaymentType.Payment);
Paymentgraph.SelectTimeStamp();
Paymentgraph.Save.Press();
}
}

}


Now everything works as it should, but the data is substituted from the code. In this case, 500. I want to substitute the value that I specify in the Postman Request. How to catch this data in the code?

Best answer by Zoltan Febert

Hi @VladyslavPoberezhets,

I don’t think it is possible to use parameters here. When I had to solve a similar problem, I ended up with two API calls. The first call populated my custom field in the Sales Order records, while the second call triggered the action. In the action handler I had the previously populated value.

1 reply

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • Answer
  • January 23, 2024

Hi @VladyslavPoberezhets,

I don’t think it is possible to use parameters here. When I had to solve a similar problem, I ended up with two API calls. The first call populated my custom field in the Sales Order records, while the second call triggered the action. In the action handler I had the previously populated value.