Reversing a JournalTransaction using the Rest API
I want to be able to reverse a Journal Transaction through the REST API, like can be done through the UI. I've extended the JournalTransaction endpoint (version 17.200.001) and added an action that invokes the ReverseBatch action.
Unfortunately, when I invoke the API I'm getting an "PX.Data.PXInvalidOperationException" message for the outer exception with an incomprehensible stack trace that didn't provide much insight into why it's not working.
The innerException sheds a little light with the message "The record cannot be saved." with the following stack trace: "at PX.Data.PXSave`1.<Handler>d__2.MoveNext()\r\n at PX.Data.PXAction`1.<Press>d__28.MoveNext()\r\n at PX.Data.PXAction`1.<Press>d__28.MoveNext()\r\n at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow A_1, PXFilterRow A_2)\r\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()"
"The record cannot be saved" error was mentioned in another thread here related to import processing, resolved by having a Dialog Action set to Yes. That doesn't seem like something that's related to API invocation, so what might be some next steps to try and determine why the API invocation isn't working?
I've tried passing through an entity body ID that doesn't exist, and that provides a different error - something akin to the action being disabled so it seems like the action is being triggered as expected - it's just not working for some reason.
If it's perhaps related, I have extended JournalTransaction to expose Orig. Batch Number, Reversing Entry, and Reversing Batches (because those fields were going to be used to determine what JournalTransactions have been reversed)
If someone else has managed to reverse a JournalTransaction via the API and can provide some further information that would be much appreciated.