Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Changing the language of the order report for the receving customer

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans