Hi All,
BC version: 19.1
deployment: OnPrem
issue: looping of records inside Repeat Until returns to the first line of the procedure code stack, after first record is inserted in the repeat until statement.
Detail description of the issue:
1. custom table no.=50000 - "ABC" with all the fields as expected. Table trigger OnInsert is not used in the table at all.
2. custom codeunit no.=50000 - "ABC Mgt." with OnRun trigger (is empty) and event subsriber is called to insert records in T5000 from another table T50001
below is the code of the CU:
Codeunit 5000 "ABC Mgt."
{ Description='DZ01'; trigger OnRun() begin end; [EventSubscriber(ObjectType::Table, Database::"ABC", 'OnAfterInsertEvent', '', false, false)] procedure InsertMissingTimesFromIntegrationTable(var ABC: Record "ABC") var: DCERec: Record "DCE"; FoundRecords: Integer; ABC2Rec: Record "ABC"; begin DCERec.RESET; DCERec.SETRANGE(DCERec."No.",Rec."No."); IF DCERec.FINDSET THEN BEGIN FoundRecords := DCERec.COUNT; REPEAT ABC2Rec."No." := DCERec."No."; ABC2Rec.Name := DCERec.First Name; ABC2Rec.INSERT(TRUE); UNTIL DCERec.NEXT() = 0; END; end; }
in this repeat until statement code moves back to line numer=14 - DCERec.RESET; and this is happening in endless loop.
I just do not understand why the code jumps after the insert command in the loop of "Repeat Until" statement to the first code line of the procedure (after Begin). Do you have some idea?
Thank you
BR Damjan