Announcements
Hi Expert,
is there a way that I can customize the D365BC process when I post a sales order to create Posted Sales Invoice in Dynamics 365 Business Central.
because I need write some my custom fields to sales invocie when I doing post sales invoice.
Thansk,
Ming
if you use these EventSubscribers, then yes it should do the needed automatically when posting an order.
please verify, if your question is answered.
Create an invoice from an order
, and then select Orders. Select the order you want to create an invoice from. Select Create Invoice at the top of the screen. Review the contents of the invoice and make any additions or corrections before sending to your customer.
Thanks, if I subscribe these events in my extension code, then I post sales order to posted sales invoice in the UI, then the D365BC will execute these events automatically, is that correct?
Thanks again.
Hi Ming,
There are multiple ways to customize this.
Scenario : 1
If you want to copy some field values from Sales Order to Posted Sales Invoice, you should create that field in both table with Same Field ID & datatype. If both field id & datatype are same, system automatically copy the values from Sales Order to Posted Sales Invoice. You don't need to do any code to copy the values.
Scenario : 2
if you want to copy field values which has different field id in both table, then you have to subscribe the below publisher to copy the values manually.
Scenario : 3
There are many events available in "Sales-Post" codeunit. you can subscribe the events to customize based on your requirement.
posting is done via codeunit 80. standard codeunits are not changeable, but there should be some events you could subscribe to. checkout onbefore and onafter events.
Hi Franz,
Thanks for your reply, if I need execute some functions during post sales order to Posted Sales Invoice and, excute some function after posting sales order to Posted Sales Invocie, is that possible?
Thanks again.
add your custom fields to table sales header and also to sales invoice header. the new fields have to have the same obectids in both tables. i think, then the values are being copied.
e.g.
table sales header:
50000 custfield01 <your datatype>
table sales invoice header:
50000 custfield01 <your datatype>
André Arnaud de Cal...
294,208
Super User 2025 Season 1
Martin Dráb
232,970
Most Valuable Professional
nmaenpaa
101,158
Moderator