Adding Field to posted sales invoice in Dynamics 365 Business Central

I have created a new field in sales order and now i want that if i post “sales order” than the field i have created appear in posted sales invoice with data i have input.

thank you

Create same field with same ID and Type in posted sales invoice table.

Cheers

yups thats working… thanks for that

nut now i want this field to appear in general ledger entries also

i have done the same step Created same field with same ID and Type . but its not working there

field is coming on the page but the data which i have input is not coming

if you can help me with that

That is a more complicated question, what version of NAV are you using?

i am working dynamics 365 business central

Al extension

As Lars writes, then this is a bit more complicated. When BC posts an invoice, table 36 becomes 112, 37 becomes 113. But the G/L table is constructed. It contains only some of the fields. In general then the header becomes the debit and the lines the credit G/L entries. It happens in codeunit 80, but the G/L entries are not created directly. It creates general journal lines, which it then uses codeunit 12 to post to G/L entries.

So in order to transfer any fields to the G/L entries, then you also need to create these fields in the general journal line table. So you need to find an event in codeunit 80, called after the general journal lines are initiated, but before they are actually posted as G/L. By subscribing to this event, then you will get access to both the content of the sales header and the journal line, and will be able to add your own fields to the gen. journal line table.

The easiest way to discover which event you can subscribe to, to also update the field in the G/L table, is to use the Event Recorder which came with the fall 2018 release of Business Central:

[View:~/nav/b/demiliani/posts/dynamics-365-business-central-using-the-event-recorder-for-developing:320:50]

So you should record what happens when you post the invoice, then it will show you exactly which events are used. If you need to update the balancing entry (the customer g/l entry), then the event is OnBeforePostBalancingEntry. But try to find the other event, if you also need to update the sales entries.

When you post something you need to understand where do you need to fill fields (because line in the GL Entry have “grouping” by linked actions).

Is it about unit price amounts lines, unit cost amount lines or “Customer debt” amount lines? The result you need to catch Event from CU 80 or CU 12 “Gen. Jnl.-Post Line”.