C12 - Function FinishPosting- new parameter with event OnAfterFinishPosting
old: LOCAL [IntegrationEvent] OnAfterFinishPosting(VAR GlobalGLEntry : Record "G/L Entry";VAR GLRegister : Record "G/L Register")
new: LOCAL [IntegrationEvent] OnAfterFinishPosting(VAR GlobalGLEntry : Record "G/L Entry";VAR GLRegister : Record "G/L Register";IsTransactionConsistent : Boolean)
Please check my previous request: https://github.com/Microsoft/AL/issues/3881
Let me try to explain again. Here is the code, if IsTransactionConsistent = FALSE you will get error on GlobalGLEntry.CONSISTENT statement. So you can reach event only if IsTransactionConsistent = TRUE. And if you want to reset value of IsTransactionConsistent in OnAfterFinishPosting, than it is already too late. Or am I misunderstand something in your ask?
….. END; GlobalGLEntry.CONSISTENT(IsTransactionConsistent);
IF CostAccSetup.GET THEN IF CostAccSetup."Auto Transfer from G/L" THEN TransferGlEntriesToCA.GetGLEntries;
FirstEntryNo := 0;
OnAfterFinishPosting(GlobalGLEntry,GLReg);
Please, review the help for CONSISTENT statement.
https://docs.microsoft.com/en-us/dynamics-nav/consistent-function--record-
The CONSISTENT statement will only mark the table, it will not raise error if parameter is false. Error will be shown at the end of transaction only if table is marked as inconsistent.
Function "FinishCodeunit" is called after creation of each g/l entry, so if you are right noone will post anything.