Current code:
procedure GetLineWithPrice(var LineWithPrice: Interface "Line With Price")
var
SalesLinePrice: Codeunit "Sales Line - Price";
begin
LineWithPrice := SalesLinePrice;
OnAfterGetLineWithPrice(LineWithPrice);
end;
...
[IntegrationEvent(true, false)]
local procedure OnAfterGetLineWithPrice(var LineWithPrice: Interface "Line With Price")
begin
end;
In order to fully extend price calculations, it would be helpful to selectively set the Line With Price interface based on a value in the Sales Line. By including the Sales Line record in the integration event param, this could easily be done with an event subscriber. Currently, the only option is to always set the Line With Price interface with the OnAfterGetLineWithPrice event without any logic based on the Sales Line.
In my case, I have extended Price List Line, Price Calculation Buffer, and Sales Line with an additional custom field and would like to alter pricing logic based on the value in the Sales Line by passing a filter to the Price List Line. This is only achievable by through the Line With Price interface (by adding the field to the Price Calculation Buffer), but I do not want that logic to run in every case.
Suggested change:
procedure GetLineWithPrice(var LineWithPrice: Interface "Line With Price")
var
SalesLinePrice: Codeunit "Sales Line - Price";
begin
LineWithPrice := SalesLinePrice;
OnAfterGetLineWithPrice(LineWithPrice, Rec);
end;
...
[IntegrationEvent(true, false)]
local procedure OnAfterGetLineWithPrice(var LineWithPrice: Interface "Line With Price", SalesLine: Record "Sales Line")
begin
end;
