1
votes

Is there any way to export or import data within Acumatica by serializing or deserializing to/from JSON, but without hitting the contract-based API? In other words, I want to serialize data (e.g. a stock item) based on the data contract, within the same Acumatica instance. Is the only way to do this to call itself via API, or is there ability to access the querying and serialization which the API performs without the API in the way?

1
Could you be more specific as to what is your end goal that might help us understand what you are trying to do and help us help you better. - samol518
Also, I just discovered that in a data row's RowPersisted event when the TranStatus is Completed, it still hasn't commited to the db yet. So if I try to hit the API for the row just "persisted", it returns nothing. - Tony Lanzer
samol518, I thought my question was pretty clear. I want to serialize data in the supported data contract format, but without hitting the API. If you're interested in specifics, I am simply trying to send data (e.g. a stock item and children) to an external queue. The only way I've found so far is via API hit. If I try to do this in the RowPersisted event per my previous comment, the row hasn't even been committed yet, so API call won't even work. - Tony Lanzer
In RowPersisted are you looking at the event args TranStatus == Completed which should be after the transaction is committed? - Brendan
Brendan, yes, as I stated previously. I just discovered that this doesn't mean it's actually committed. It must mean that's it's about to be. I even queried directly in the db, and it's not there until leaving RowPersisted. - Tony Lanzer

1 Answers

2
votes

The simplest way to accomplish your task is by overriding the Persist() method in a custom BLC or a BLC extension. After the base method invocation, you should start a background thread by executing PXLongOperation.StartOperation() to serialize the items that you are going to transfer and send them to an external service.