Closed Herodoteux closed 3 years ago
Clarify the placement of required event - on the picture it is inserted between functions. You help us implementing the requests faster when your request contains AL code copied from VSCode instead of screenshots.
It's locate on the local procedure GetCountryCode local procedure GetCountryCode(SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"): Code[10] var SalesShipmentHeader: Record "Sales Shipment Header"; CountryRegionCode: Code[10]; IsHandled: Boolean; begin IsHandled := false; OnBeforeGetCountryCode(SalesHeader, SalesLine, CountryRegionCode, IsHandled); if IsHandled then exit(CountryRegionCode);
if SalesLine."Shipment No." <> '' then begin
SalesShipmentHeader.Get(SalesLine."Shipment No.");
IsHandled := false;
OnBeforeSaleShipmentHeader(SalesHeader, SalesShipmentHeader, SalesLine, IsHandled);
if not IsHandled then
exit(
GetCountryRegionCode(
SalesLine."Sell-to Customer No.",
SalesShipmentHeader."Ship-to Code",
SalesShipmentHeader."Sell-to Country/Region Code"));
end;
IsHandled := false;
OnAfterGetCountryCode(SalesHeader, SalesLine, IsHandled);
if not IsHandled then
exit(
GetCountryRegionCode(
SalesLine."Sell-to Customer No.",
SalesHeader."Ship-to Code",
SalesHeader."Sell-to Country/Region Code"));
end;
_OnBeforeSellToCountry(SalesHeader, SalesLine, SalesShipmentHeader);___
The line 5589: " end;" is the end of the function GetCountryCode. We cannot call an event outside of the function. You also want to name it OnBeforeSellToCountry though the function called GetCountryCode. What is the point?
Yes sorry my mistake the event need to be in the procedure GetCountryCode mutch like this : Sorry it's because in navision there is not begin end in procedure
You help us implementing the requests faster when your request contains AL code copied from VSCode instead of screenshots.
The latest source code differs from code you described. You can use existent event OnBeforeGetCountryCode to overwrite the logic.
Hi, in the Codeunit 80 Sales Post, would it be possible to get an event OnBeforeSellToCountry, like this :
Thanks