Skip to main content
Solved

How to handle a dialog when executing an action via the API?

  • June 16, 2025
  • 2 replies
  • 76 views

The API I’m trying to use:

Custom API, Entity representing the “Employee” screen (EP203000), an Action mapped to the “GenerateTimeCards” action.

The Request I’m using:

A “POST request using this JSON:

{
"entity": {
"EmployeeID": { "value": "A real employee ID" }
},
"parameters": {}
}

The Error:

HTTP 500, with the words “PX.Data.PXInvalidOperationException” in the stack trace.

The Question:

If I try to use this action from the UI, I am indeed presented with a dialog box.  I’d love to be able to figure out a way to tell the API to accept the dialog box with no changes, like I just clicked “OK” in the UI. I can’t seem to find any reference to this on the internet.  Does anybody know if this is even possible?  Thanks if you can help!

Best answer by Dmitrii Naumov

@joegrist unfortunately, this scenario is not supported via API unless there is a special handler in the code. 

Usually, in these situations we recommend going from the other end. If you want to generate a Time Card for an employee, you can create a record of TimeCard type and specify employee there. 

In UI the GenerateTimeCards action helps with the system usability, but in API you can definitely just automate it on the sending side. 

2 replies

DipakNilkanth
Pro III
Forum|alt.badge.img+13

Hi ​@joegrist,

Try to send Parameters like below.
 

{
"entity": {
"EmployeeID": { "value": "EP00000002" }
},
"parameters": {
"LastDateGenerated": { "value": "2024-06-01" },
"GenerateUntil": { "value": "2024-06-07" }
}
}

Hope, it helps!


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • Answer
  • June 16, 2025

@joegrist unfortunately, this scenario is not supported via API unless there is a special handler in the code. 

Usually, in these situations we recommend going from the other end. If you want to generate a Time Card for an employee, you can create a record of TimeCard type and specify employee there. 

In UI the GenerateTimeCards action helps with the system usability, but in API you can definitely just automate it on the sending side.