Hey Erik, thanks for the advice. I actually did it with onAfterInsert. now i can insert ItemB and so on. But now my issue is when updating the values. if i update “qty to ship” field of itemA, ItemB does not update. I spent alot of time with it but cannot find a solution. my code for updating looks like this:
SalesLine2.SETRANGE(“Document No.”,Rec.“Document No.”);
SalesLine2.SETRANGE(“Document Type”,Rec.“Document Type”);
SalesLine2.SETRANGE(LineRef,Rec.“Line No.”);
IF SalesLine2.FINDSET THEN
REPEAT
salesLine2.“Qty. to Ship” := Rec.“Qty. to Ship”;
UNTIL SalesLine2.NEXT = 0;
i have multiple Items that has a relation to ItemA. When i change the value of itemA, other lines does not change. I subscribet to OnAfterModify event. Hope somebody have a solution of a code example on how to solve this issue.
NB: LineRef is a field to reference to ItemA.