web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Flow data from sales Header to gl entry

(0) ShareShare
ReportReport
Posted on by 151

hello 

I want to flow data from sales header to gl entry. I have created field on sales header and gl entry. So as i post sales order i want that data to be flow to gl entry. So how  can we do that in busiuness central.

[EventSubscriber(ObjectType::Table, 81, 'OnAfterCopyGenJnlLineFromSalesHeader', '', false, false)]
       local procedure OnAfterCopyGenJnlLineFromSalesHeader(var GenJournalLine: Record "Gen. Journal Line";SalesHeader: Record "Sales Header")
       begin
           GenJournalLine."Nick Name":=SalesHeader."Practice Name";
       end;
       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnAfterPostCustomerEntry', '', false, false)]
       local procedure MyProcedure(var GenJnlLine: Record "Gen. Journal Line";var SalesHeader: Record "Sales Header")
       var
       glEntry: Record "G/L Entry";
       begin
           glEntry."Nick Name":=GenJnlLine."Nick Name";
           
       end;
I tried above code but not working . Any body can help?
I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    Can you please change your code as per below?

       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterInitGLEntry', '', true, true)]

       local procedure OnAfterInitGLEntry(var GLEntry: Record "G/L Entry"; GenJournalLine: Record "Gen. Journal Line"; Amount: Decimal; AddCurrAmount: Decimal; UseAddCurrAmount: Boolean; var CurrencyFactor: Decimal)

       begin

              glEntry."Nick Name":=GenJnlLine."Nick Name";

       end;

       [EventSubscriber(ObjectType::table, database::"Gen. Journal Line", 'OnAfterCopyGenJnlLineFromSalesHeader', '', true, true)]

       local procedure OnAfterCopyGenJnlLineFromSalesHeader(SalesHeader: Record "Sales Header"; var GenJournalLine: Record "Gen. Journal Line")

       begin

              GenJournalLine."Nick Name":=SalesHeader."Practice Name";

       end;

  • Salba Z.K Profile Picture
    151 on at

    Thanks Nitin,

    It worked

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Great, Good to know that your problem is solved.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans