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

Community site session details

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

Mirror Posting Entries

(0) ShareShare
ReportReport
Posted on by 260

Greetings to all of you.

I am trying to understand how the whole posting routine works in Business Central.

My task is : I have a created a custom table , similar to the g/l entries table.

I need , by the time the system creates a g/l entry , to create/insert this exact one line on my custom table as well.

Due to that, i am trying to find the right event so subscribe so that i can achieve that.

This is all i need for now , just to copy/insert the g/l entry line , to my custom table as well.

Any thoughts on that?

Thank you in advance for your time!

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    RE: Mirror Posting Entries

    Try one of these integration events that you will find in codeunit 12

    [IntegrationEvent(false, false)]

       local procedure OnBeforeInsertGlEntry(var GenJnlLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry"; var IsHandled: Boolean)

       begin

       end;

       [IntegrationEvent(true, false)]

       local procedure OnAfterCreateGLEntry(var GenJnlLine: Record "Gen. Journal Line"; var GLEntry: Record "G/L Entry"; NextEntryNo: Integer)

       begin

       end;

    And just out of curiosity, what is the business case for duplicating the G/L Entry table?

    That is normally something we would try to avoid.

  • AntonisK Profile Picture
    260 on at
    RE: Mirror Posting Entries

    Thank you for your answer and sorry for the late response.

    The case is related to the deferral posting.

    Example: Lets say we have a 12 month deferral , 12.000 amount, posting date 1/11/2022 ( 1.000 per month).

    I need to achieve the goals below:

    1) Do not allow the system to immediatly post the g/l entries for the upcoming months ( 1/12/2022 , 1/1/2023 e.t.c).

    2) Save the g/l entries info on a custom table.

    3) Developed an automated process which will run daily , and if the current date = posting date , then copy this line ( from my custom table ) , insert in a general journal batch and post it.

    In short , the final result will be that the deferral which has posting 1/12/2022 , is going to be posted at this exact date and not the day that the purchase invoice was posted ( 1/11/2022).

    I have already managed to achieve the first 2 steps , by subscribing to the OnPostDeferralPostBufferOnAfterSetFilters event.

    I am using the deferralpostbuffer to copy each line to my own custom table so that i can save the line information.

    At the same time , before my event subscribe ends, i setrange the deferralpostbuffer so that it will only contain the first entry which is the credit/debit of the whole deferral amount between the expense account and the deferral acount.

    At the moment i am trying to find a base codeunit/report which will help me insert the lines from my custom table to a general journal batch and then automatically post them. Any thoughts on that?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at
    RE: Mirror Posting Entries

    You can watch how Erik Hougaard does this posting in his YouTube video:

    https://youtu.be/wv1xM9oW6NQ

  • Suggested answer
    YUN ZHU Profile Picture
    95,307 Super User 2025 Season 2 on at
    RE: Mirror Posting Entries

    Hi, For the third point, I personally think that it is possible to develop a Codeunit and set it up in the Job Queue.

    There was a previous discussion here about automatic posting General Journal, hopefully will give you some hints as well.

       

    Thanks.

    ZHU

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,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans