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

[W1][Codeunit][6212][Sustainability Post Mgt] OnAfterInsertSustainabilityLedgerEntry event in InsertLedgerEntry

Aperta Adatta ai principianti
#13,082 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
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github

Direzione di ricerca

Inizia con Codeunit 6212, «Sustainability Post Mgt», e leggi InsertLedgerEntry insieme a OnBeforeInsertSustainabilityLedgerEntry. Aggiungi l’Integration Event richiesto dopo la creazione delle relazioni con l’insert e il G/L entry, all’interno del blocco if not IsHandled, passando il ledger entry inserito e la source journal line. Il lavoro è completato quando i subscriber possono ricevere entrambi i record dopo l’inserimento, con Entry No. e SystemId della nuova voce disponibili.

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

Descrizione

Team: Finance
Why do you need this change?

Our extension creates Sustainability Journal Lines and posts them. Afterwards it needs to know which Sustainability Ledger Entry was created from which journal line. For that, at one point in time, we need the reference to the journal line together with the SystemId of the newly inserted ledger entry.

The General, Item, Job and Cost journals already provide an event that passes both the inserted entry and its source journal line:

  • "Gen. Jnl.-Post Line".OnAfterInsertGlobalGLEntry(var GLEntry; var TempGLEntryBuf; var NextEntryNo; GenJnlLine)
  • "Item Jnl.-Post Line".OnAfterInsertItemLedgEntry(var ItemLedgerEntry; ItemJournalLine; ...)
  • "Job Jnl.-Post Line".OnAfterJobLedgEntryInsert(var JobLedgerEntry; JobJournalLine)
  • "CA Jnl.-Post Line".OnAfterCostEntryInsert(var CostEntry; CostJournalLine)

Codeunit 6212 "Sustainability Post Mgt" has no such event. InsertLedgerEntry only raises:

  • OnBeforeInsertSustainabilityLedgerEntry (IntegrationEvent): raised before Insert(true), when the entry has no Entry No. and no SystemId yet.
  • OnInsertLedgerEntryOnBeforeInsert (InternalEvent, on main): not subscribable from other apps, and also raised before the insert.

The table's OnAfterInsertEvent has the SystemId of the new entry, but no reference to the journal line. To bring both together today, an extension has to carry the journal line reference on the ledger entry itself (an extra field in a table extension, filled in the OnBefore event) and then evaluate it in a second subscriber on the table's OnAfterInsertEvent. That is an extra field on every ledger entry only to pass information between two events.

An OnAfter event in InsertLedgerEntry that passes the inserted entry and the journal line would make this workaround unnecessary. It would also help other apps that need to link Sustainability Ledger Entries to their journal lines, in the same way as the existing events for the other journals.

Describe the request

Add an integration event in InsertLedgerEntry after the ledger entry is inserted. It is raised only when the entry was actually inserted (inside the if not IsHandled block), so the entry has its Entry No. and SystemId.

[W1][Codeunit][6212][Sustainability Post Mgt]
procedure InsertLedgerEntry(SustainabilityJnlLine: Record "Sustainability Jnl. Line")
___

Raise an event after the Sustainability Ledger Entry is inserted, with the inserted entry and the journal line it was posted from.
___

    // current code
    OnBeforeInsertSustainabilityLedgerEntry(SustainabilityLedgerEntry, SustainabilityJnlLine);

    IsHandled := false;
    OnInsertLedgerEntryOnBeforeInsert(SustainabilityLedgerEntry, IsHandled);
    if not IsHandled then begin
        SustainabilityLedgerEntry.Insert(true);
        CreateGLEntryRelations(SustainabilityJnlLine, SustainabilityLedgerEntry."Entry No.");
        OnAfterInsertSustainabilityLedgerEntry(SustainabilityLedgerEntry, SustainabilityJnlLine); // new
    end;

[IntegrationEvent(false, false)]
local procedure OnAfterInsertSustainabilityLedgerEntry(var SustainabilityLedgerEntry: Record "Sustainability Ledger Entry"; SustainabilityJnlLine: Record "Sustainability Jnl. Line")
begin
end;

The name and parameters follow the existing OnBeforeInsertSustainabilityLedgerEntry in the same codeunit. Please also add the event to the latest release branch if possible.

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.