Error while Posting Sales/Purchase Document for IC Partner with Auto. Send Transactions
Hello,
Our App is subscribing OnRunOnBeforeFinalizePosting event of Sales Post codeunit and the event subscription function assign value to custom fields and then modify sales header record (i.e. SalesHeader.Modify();)
This works as expected on most of the cases except when Auto. Send Transaction is checked in Intercompany Setup, and the document is for IC partner. In this scenario it will produce and error "The changes to the Record cannot be saved because some information on Page is not up-yo-date. Close the page."
This happens because UpdateICStatus function of codeunit IC Outbox Export modifies instance of Sales Header/Purchase Header. This would not happen if Sales or Purchase Header was passed as a parameter with Reference.
Thanks

Where do you want SalesHeader and PurchaseHeader parameters as VAR? Please clarify.
I get it, we cannot pass sales/purchase header as Reference because of how this function is structured. But if MS can find a way to remove UpdateICStatus function from IC Outbox Export Codeunit and put is under Codeunit 80 and 90 then this would resolve issue of modifying different instance of variable. This new function (which update IC Status on Document) then can also be called from IC Outbox Export page.
Hi @pranav4186 . Do you have a call stack when it fails OnRunOnBeforeFinalizePosting?
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.