In a project for a customer, not all products are registered in BC, and we want to add a remark on the order line, when DW sends an order including an unknown item number.
In the CreateOrder method in the standard codeunit, when iterating through the order lines sent from DW, we do a look-up on the item number to validate that the item exists, before adding the line. If the item doesn't exist in BC, the codeunit will throw an error.
The problem is that the OnBeforeCreateSalesLine event is invoked after this validation, so we don't have any opportunity to catch this and perform the special logic that applies for these scenarios.
It seems that we need to hook into the OnBeforeCreateOrderRequest and inspect and manipulate with the information on the order lines in the input xml before it is sent further down the pipeline.
It would be helpful, if the validation was moved until after the OnBeforeCreateSalesLine event has been invoked.
In a project for a customer, not all products are registered in BC, and we want to add a remark on the order line, when DW sends an order including an unknown item number.
In the CreateOrder method in the standard codeunit, when iterating through the order lines sent from DW, we do a look-up on the item number to validate that the item exists, before adding the line. If the item doesn't exist in BC, the codeunit will throw an error.
The problem is that the OnBeforeCreateSalesLine event is invoked after this validation, so we don't have any opportunity to catch this and perform the special logic that applies for these scenarios.
It seems that we need to hook into the OnBeforeCreateOrderRequest and inspect and manipulate with the information on the order lines in the input xml before it is sent further down the pipeline.
It would be helpful, if the validation was moved until after the OnBeforeCreateSalesLine event has been invoked.