Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

New Procedure in Standard Event (Code Unit)

Posted on by 295
I wrote a code unit but I wonder whether my code overrides 3rd Vendor or standards event code
 
Or my code will works independently ?
 
  [EventSubscriber(ObjectType::Table, database::/Vendor Ledger Entry/, 'OnAfterCopyVendLedgerEntryFromGenJnlLine', '', true, true)]
    procedure TLC_InsertVendLed(VAR VendorLedgerEntry: Record /Vendor Ledger Entry/; GenJournalLine: Record /Gen. Journal Line/)
    var
    begin
        IF GenJournalLine./TLC Employee Code/ <> '' THEN
            VendorLedgerEntry./TLC Employee Code/ := GenJournalLine./TLC Employee Code/;
    end;
    [EventSubscriber(ObjectType::Table, Database::/Vendor Ledger Entry/, 'OnAfterCopyVendLedgerEntryFromCVLedgEntryBuffer', '', true, true)]
    local procedure TLC_OnAfterCopyVendLedgerEntryFromCVLedgEntryBuffer(var VendorLedgerEntry: Record /Vendor Ledger Entry/; CVLedgerEntryBuffer: Record /CV Ledger Entry Buffer/)
    begin
        if CVLedgerEntryBuffer./TLC Employee Code/ <> '' then
            VendorLedgerEntry./TLC Employee Code/ := CVLedgerEntryBuffer./TLC Employee Code/;
    end;
    [EventSubscriber(ObjectType::Table, Database::/Vendor Ledger Entry/, 'OnAfterCopyVendLedgerEntryFromGenJnlLine', '', true, true)]
    local procedure TLC_OnAfterCopyVendLedgerEntryFromGenJnlLine(var VendorLedgerEntry: Record /Vendor Ledger Entry/; GenJournalLine: Record /Gen. Journal Line/)
    begin
        if GenJournalLine./TLC Employee Code/ <> '' then
            VendorLedgerEntry./TLC Employee Code/ := GenJournalLine./TLC Employee Code/;
    end;
Categories:
  • Hoang Ng Profile Picture
    Hoang Ng 295 on at
    New Procedure in Standard Event (Code Unit)
    Until now, I would like to update there is no problem with above code
  • Verified answer
    Hoang Ng Profile Picture
    Hoang Ng 295 on at
    New Procedure in Standard Event (Code Unit)
    Thanks Teddy.
     
    From your explanation, I understand all the codes will go parallel
    I must only be carefully if I modify same Field as Standard or 3rd 's one.
     
    Hi Yadav,
     
    I means whether my code will work then standard code or 3rd code will stop if I use same event.
  • Verified answer
    TeddyH Profile Picture
    TeddyH 12,868 Super User 2024 Season 1 on at
    New Procedure in Standard Event (Code Unit)
    Your code will not overwrite. You code is an addition to the standard or any other app that subscribe to the same event.
    Unless there are other app that is working on TLC Employee Code, it is safe to assume that your code will not overwrite other code.
  • Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    New Procedure in Standard Event (Code Unit)
    What do you mean by "overrides 3rd Vendor or standards event code?
     
    Can you please explain?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans