Field Position on CH Version
Describe the request
Please add an event into the calcposition function on table Sales Line
[Scope('OnPrem')] procedure CalcPosition(FixedNumber: Integer) var PosBefore: Integer; PosAfter: Integer; begin if not (CheckQuoteMgtPermission() or (CopyStr(SerialNumber, 7, 3) = '000')) then exit;
if (FixedNumber >= 10) and ("No." <> '') then begin
Position := FixedNumber;
exit;
end;
Additional context
When I try to add multiple lines betwen 2 sales line, in the swiss version an error is raised Please add an event so that thi field position can be managed manually Internal work item: AB#556643
Hi @DamianoCastagna , Please specify event publisher and place where it should be raised in more detail.
Hi @JakovljevicDusan the event should be placed at the begin of the function
[Scope('OnPrem')] procedure CalcPosition(FixedNumber: Integer) var PosBefore: Integer; PosAfter: Integer; begin
// Add event
OnBeforeCalcPosition(Position,Rec,isHandled)
if ishandled then
exit;
// End
if not (CheckQuoteMgtPermission() or (CopyStr(SerialNumber, 7, 3) = '000')) then
exit;
if (FixedNumber >= 10) and ("No." <> '') then begin
Position := FixedNumber;
exit;
end;
if HasTypeToFillMandatoryFields() and ("No." <> '') then begin
PosBefore := 0;
PosAfter := 0;
SalesLine2.Reset();
SalesLine2 := Rec;
SalesLine2.SetRange("Document No.", "Document No.");
SalesLine2.SetRange("Document Type", "Document Type");
SalesLine2.SetRange(Type, Type::"G/L Account", Type::"Charge (Item)");
SalesLine2.SetFilter("No.", '<>%1', '');
if SalesLine2.Find('<') then
PosBefore := SalesLine2.Position;
SalesLine2 := Rec;
if SalesLine2.Find('>') then
PosAfter := SalesLine2.Position;
if PosAfter > 0 then begin
if PosAfter - PosBefore < 2 then
Error(Text90801 + Text90802, "Document Type");
Position := Round((PosAfter + PosBefore) / 2, 1);
end else
Position := PosBefore + 10;
end else
Position := 0;
end;
// [IntegrationEvent(false, false)] local procedure OnBeforeCalcPosition(var SalesLine: Record "Sales Line"; var Position : Integer ; var IsHandled: Boolean) begin end;
Hello @DamianoCastagna Thanks for the clarification, we will add the event
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.
Build ID: 32367.
Availability update: We will publish a fix for this issue in the next update for release 26.
Build ID to track: 32403.