ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

C12 - Function FinishPosting- new parameter with event OnAfterFinishPosting

Open Halilovast opened this issue 7 years ago • 2 comments

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

Halilovast avatar Dec 11 '18 15:12 Halilovast

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);

AlexanderYakunin avatar Dec 17 '18 14:12 AlexanderYakunin

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.

Halilovast avatar Dec 17 '18 16:12 Halilovast