Insert record after Event subscription
Hello to all, I am subscribing to the OnAfterGetDocumentEntries event of the Codeunit 5530 Calc. Item Availability to create a function that inserts records in the 5530 Inventory Event Buffer table, just like the standard TryGetPurchOrderSupplyEntries function.
What happens is that if I make an Insert on the table I get the following error when leaving the subscribed event: "Entity source type not supported = 0, origin subtype = 0". But if I comment the Insert line the error does not appear. Something similar happened to someone working with events?
Edit: What is happening is this: if you subscribe to a public event whose parameter is a VAR record, the system fails. But if in the subscribed event you do not create the parameter as VAR the system does not fail. This does not make much sense, since in the case of the OnAfterGetDocumentEntries event of the Codeunit 5530 the event parameter is VAR. If you cannot subscribe to it as VAR it means that the variable InvtEventBuf is not going to keep the records that you generate from your subscription
This is an application related question. This repository no longer handles general questions and is only dedicated to bug reports and feature suggestions for the latest preview version of the AL compiler and developer tools. Maybe try here: https://github.com/Microsoft/ALAppExtensions