Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Changing the language of the order report for the receving customer

(0) ShareShare
ReportReport
Posted on by 8

I'm having some trouble with the language of the report I'm sending to my customer. Let's say that the customer is Chinese; the only words on my report that will change to Chinese are the date. I have tried different code logic, but can't understand why it's not working. The closest I get to is that it changes to English language; that's about it. I only have two translation files in my project: one for Norwegian language and one for English. My question is, do I have to add translation files for every language out there? How can I solve the problem so the report is set automatically to the customer's language?

Here's the code logic I've tried out:

 
 
reportextension 50105 SalesOrderConfirmationExt extends CR_SalesOrderConfirmation
{
    dataset
    {
        modify(Header)
        {
            trigger OnAfterAfterGetRecord()
            var
                Customer: Record Customer;
                Language: Codeunit Language;
                FormatAddr: Codeunit /Format Address/;
            begin
                Customer.SetRange(/No./, /Sell-to Customer No./);
                if Customer.FindFirst() then begin
                    CurrReport.Language := Language.GetLanguageIdOrDefault(Customer./Language Code/);
                    CurrReport.FormatRegion := Language.GetFormatRegionOrDefault(Customer./Format Region/);
                    FormatAddr.SetLanguageCode(Customer./Language Code/);
                end;
            end;
        }
 
        add(Line)
        {
            column(ProductInfo; ProductInfo) { }
            column(SalesInfo; SalesInfo) { }
            column(Shipping_Agent_Code_Lbl; 'Shipping Agent Code') { }
            column(Shipping_Agent_Code; /Shipping Agent Code/) { }
        }
    }
}
reportextension 50101 CR_CustomPurchaseOrderExt extends CR_CustomPurchaseOrder
{
    dataset
    {
        modify(/Purchase Header/)
        {
            trigger OnAfterAfterGetRecord()
            var
                Language: Codeunit Language;
                FormatAddr: Codeunit /Format Address/;
            begin
                CurrReport.Language := Language.GetLanguageIdOrDefault(/Language Code/);
                CurrReport.FormatRegion := Language.GetFormatRegionOrDefault(/Format Region/);
                FormatAddr.SetLanguageCode(/Language Code/);
            end;
        }
 
        add(/Purchase Header/)
        {
            column(JobDescription; JobDescription) { }
            column(/External_Document_No/; /ExternalDocumentNo/) { }
            column(ExternalDocumentNo_Lbl; 'External document no.') { }
            column(YourReference_Lbl; 'Your reference') { }
            column(Shipping_Agent_Code_Lbl; 'Shipping agent code') { }
            column(Shipping_Agent_Code; Shipping_Agent_Code) { }
        }
        add(/Purchase Line/)
        {
            column(ProductInfo; ProductInfo) { }
            column(SalesInfo; SalesInfo) { }
        }
 
    }
 
}
reportextension 50106 SalesInvoiceExt extends CR_SalesInvoice
{
    dataset
    {
        modify(Header)
        {
 
        /*/
                        trigger OnAfterAfterGetRecord()
                        var
                             Languagemgt: Codeunit Language;
                            FormatAddr: Codeunit /Format Address/;
                            Cust: Record /Customer/;
                            Countrycode: Code[10];
                            CustomerNo: code[20];
                        begin
                           CurrReport.FormatRegion := 'de-DE';
                        end;
         
                      */  
                       
                       
        }
 
        add(Line)
        {
            column(ProductInfo; ProductInfo) { }
            column(SalesInfo; SalesInfo) { }
        }
    }
 
}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,277 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,019 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans