Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[W1][MultiObjects] Undo Service Shipment Line / Undo Service Consumption Line - OnAfter event after the corrective Service Shipment Line is inserted

Aperta Adatta ai principianti
#13,250 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
backend

Direzione di ricerca

Leggi i Codeunits 5818 “Undo Service Shipment Line” e 5819 “Undo Service Consumption Line”, concentrandoti su InsertNewShipmentLine e InsertCorrectiveShipmentLine. Aggiungi gli Integration Events richiesti dopo l’inserimento, con i record delle righe di spedizione nuove e precedenti. Verifica quindi che ogni evento venga generato immediatamente dopo Insert() e una volta per ciascuna riga stornata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Team: SCM

Why do you need this change?

Our app stores data in a companion table that is linked to document lines and posted document lines by SystemId. When a posted line is undone, we must copy that data from the original posted line to the new corrective line, so we need both records at the moment the corrective line is inserted.

For Sales and Purchase this is possible with the existing events raised right after the corrective line insert:

  • Codeunit 5815 "Undo Sales Shipment Line": OnAfterNewSalesShptLineInsert(var NewSalesShipmentLine; OldSalesShipmentLine)
  • Codeunit 5813 "Undo Purchase Receipt Line": OnAfterNewPurchRcptLineInsert(...)
  • "Undo Return Shipment Line" / "Undo Return Receipt Line": OnAfterNewReturnShptLineInsert(...) / OnAfterNewReturnRcptLineInsert(...)

The Service equivalents have no such event:

  • Codeunit 5818 "Undo Service Shipment Line" raises OnBeforeNewServiceShptLineInsert(NewServShptLine, OldServShptLine) before the insert, but nothing after it. The later OnAfterInsertNewShipmentLine in Code only receives the old line, so the new line (and its SystemId) is not available.
  • Codeunit 5819 "Undo Service Consumption Line" raises OnInsertCorrectiveShipmentLineOnBeforeInsert(...) before the insert, but nothing after it.

Before the insert the SystemId is not assigned yet. As a workaround we now search for the corrective line afterwards with a filter (Correction = true, same Order No./Order Line No., greater Line No.). This is fragile when several lines are undone in one run and it costs an extra read per line. Any extension that keeps line-level data keyed by SystemId (or that needs to copy custom data to the corrective line after insert) has the same gap in Service.

Describe the request

Add one OnAfter integration event directly after the corrective Service Shipment Line is inserted, in both codeunits, mirroring OnAfterNewSalesShptLineInsert. Both objects are in one request because it is the same change for the same scenario (undoing posted service lines).

[W1][Codeunit][5818][Undo Service Shipment Line]
procedure InsertNewShipmentLine
___

Raise an event after NewServShptLine.Insert(), with the new and the old line (same signature as OnBeforeNewServiceShptLineInsert).
___

        NewServShptLine.Correction := true;
        NewServShptLine."Dimension Set ID" := OldServShptLine."Dimension Set ID";
        OnBeforeNewServiceShptLineInsert(NewServShptLine, OldServShptLine);
        NewServShptLine.Insert();
        OnAfterNewServiceShptLineInsert(NewServShptLine, OldServShptLine); // new

        InsertItemEntryRelation(TempGlobalItemEntryRelation, NewServShptLine);
    end;

[IntegrationEvent(false, false)]
local procedure OnAfterNewServiceShptLineInsert(var NewServiceShipmentLine: Record "Service Shipment Line"; OldServiceShipmentLine: Record "Service Shipment Line")
begin
end;
[W1][Codeunit][5819][Undo Service Consumption Line]
procedure InsertCorrectiveShipmentLine
___

Raise an event after NewServiceShipmentLine.Insert(), with the new and the old line (same signature as OnInsertCorrectiveShipmentLineOnBeforeInsert).
___

        NewServiceShipmentLine.Correction := true;

        OnInsertCorrectiveShipmentLineOnBeforeInsert(NewServiceShipmentLine, OldServiceShipmentLine);
        NewServiceShipmentLine.Insert();
        OnInsertCorrectiveShipmentLineOnAfterInsert(NewServiceShipmentLine, OldServiceShipmentLine); // new

        UpdateItemJnlLine(NewServiceShipmentLine, ItemShptEntryNo);
        if OldServiceShipmentLine.Type = OldServiceShipmentLine.Type::Item then begin

[IntegrationEvent(false, false)]
local procedure OnInsertCorrectiveShipmentLineOnAfterInsert(var NewServiceShipmentLine: Record "Service Shipment Line"; OldServiceShipmentLine: Record "Service Shipment Line")
begin
end;

Notes:

  • No IsHandled, no behavior change. Raised once per undone line, with no extra database reads.
  • The records are already in scope at that point, and no sensitive data is exposed.

Related requests (Service parity with Sales/Purchase, same scenario family): #13251 (service line pages OnAfterNoOnAfterValidate), #13251 (Service Line InitType), #13251 (Serv-Documents Mgt. finalize line events)

Provide an implementation (optional)

  • I will provide the implementation for this extensibility request
Lingua principale
AL
Stelle
714
Fork
482
Merge medio
3g 5h
PR unite (30g)
559

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/BCApps

Tutte le issue di microsoft/BCApps

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.