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?