The AX data is "stored" in the database at the point of doInsert()
/doUpdate()
or super()
calls in insert()/update()
methods.
However, as Jay mentioned, the records will not be visible to other transactions (unless you explicitly allow dirty/uncommitted selects). So it may not be visible to your stored procedure.
I would not recommend calling stored procedures in insert()/update()
anyway as this has performance implications, and you are now depending on yet another database being alive!
The way to go:
- log insert/update in a separate table for that purpose (consider using standard database logging).
- From the other database regularly monitor the log for new records (say every 15 seconds).
- Do your insert/update in the other database based on a join of the log and the AX table.
Log table layout (one of millions):
- LogType - 1=insert, 2=update, 3=delete
- LogStatus - 0=not transferred, 1=under transfer, 2=transferred, 3=error???
- RefRecId - RecId of AX record
- RefTableId - TableId of AX table (if you need to log more than one table)
- RefCompanyId - Company of AX record (maybe the table is shared virtually)
Recommendations:
- Use RecId as the join key and remember to enable RecId index on the AX table.
- Remember to select on
DATAAREAID
(must be spelled this way) as well.
- Update the
LogStatus
to 1 before the join and to 2 after the join and update.