RE: convert "Sell-to Country/Region Code" to "Country Description"
Very good point Kim Dallefeld !
Here is how you can use that codeunit as well. The only challange with that codeunit is that it is hard to predict where in the textarray the country name will end up. So in some cases i go straight to the source if it is one single filed i am looking for.
codeunit 50101 "Test Country description"
{
trigger OnRun()
var
AddressFormat: Codeunit "Format Address";
SalesInvoice: Record "Sales Invoice Header";
Country: Record "Country/Region";
TextArray: array[8] of text[100];
i: Integer;
begin
if SalesInvoice.FindSet() then
repeat
Country.get(SalesInvoice."Sell-to Country/Region Code");
Message('The country is %1', Country.Name);
AddressFormat.SalesInvSellTo(textarray, SalesInvoice);
I := 0;
for i := 0 to 7 do begin
Message('Address is %1', TextArray[i]);
i += 1;
end;
until SalesInvoice.Next() = 0;
end;
}