Equisys technical notes

Technical guidance, explanations and fixes for our products

HOWTO: Extend Zetadocs to change the output filename based on the customer’s language



ID: ZTN4417

This Zetadocs technical note applies to:

  • Version 7.0 of Zetadocs for NAV and later
  • Zetadocs for NAV Delivery Essentials or Zetadocs for NAV Delivery Plus


This article demonstrates how you can use the GetOutputFileName to change the name of the file that Zetadocs for NAV outputs based on the language of the customer who will be receiving it.

Out of the box Zetadocs names attachments in the language of the NAV system itself. An English language system will output names like “Sales Order-12345”. This document discusses updating the Codeunit 9009962 “Zetadocs-Send Integration” to look up the language of the customer and output a filename in the customer’s preferred language.

To do this, the code will need to look up the “Language Code” field of the customer, and looks that up in the “Languages” table to obtain the “Windows Language ID” field, which is then used to create a string in the language of the customer that can then be used as the filename. If the customer does not have a language code set, the output filename will default to the language that NAV is configured for.

The “GetOuptutFileName” method that will be modified has different sections for each of the types of record that can be exported. This article covers updating the output filename from Sales Header record, but this technique can be applied to any of the other record types.

More information

The steps below have been written for an environment which has Dynamics NAV 20015 installed and configured with Zetadocs. Similar steps may apply to other versions of Dynamics NAV.

Open the Zetadocs-Send Integration Codeunit

  1. In the NAV Development Environment, navigate to Codeunit 9009963 – Zetadocs-Send Integration and click “Design”
  2. Scroll to the “GetOutputFileName” function
  3. Go to Tools > C/AL Locals > Variables
  4. Add the following variables:
    1. lang – Record – Language
    2. cust – Record – Customer
    3. retStr – Text – 250
    4. windowsLangId – Integer
  5. In the code, navigate to the Record Type that you want to update the output filename for (ie. For Sales Headers, navigate to the line that reads “36: //"Sales Header"”
  6. Remove the line that reads “EXIT(STRSUBSTNO(‘%1-%2 %3’, strSales, FORMAT(fieldRef2), fieldRef.VALUE));” – this is the line that creates the default file name.

  1. Paste the following code in its place:

      //Load customer object to find language code

      custRef := RecRef.FIELD(2);


      IF lang.GET(cust."Language Code") THEN

        windowsLangId := lang."Windows Language ID"


        windowsLangId := 0;

      CASE windowsLangId OF

        ELSE //All other/unknown language

          retStr := ‘Sales Order-%1’


      EXIT(STRSUBSTNO(retStr, fieldRef.VALUE));

  1. Look up the Locale ID(s) that you want to support on the “Locale Ids Assigned by Microsoft” article here: https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx – and select the “LCID Dec” value. For example, supporting French and German, you would get 1036 and 1031.
  2. Copy the following lines and paste them below “CASE windowsLangId OF” and before the “ELSE” line – repeating this process for each language you want to support

        9999: //Place Locale ID here

          retStr := 'Language - %1';

  1. Replace the 9999 ID with the Locale ID, and set retStr to the output file name that is correct for the language. For example, to support French and German, you would end up with lines like this:

        1036: //French

          retStr := 'Confirmation De Commande - %1';

        1031: //German

          retStr := 'Auftrags - %1';

  1. Your code should now look like this:

  1. Update the language in the “ELSE” statement to reflect the customer’s default language
  2. Compile the Codeunit by pressing F11

Test your system

You are now ready to test your work.

  1. Ensure you have a customer with a language set to a supported language
  2. Print a record that is supported by the changes made to the Codeunit
  3. You should now see the filename of the attached file is in the correct language
  4. Repeat the test with a customer that does not have a language set
  5. You should now see the filename of the attached file is in the correct language


Use the Zetadocs for NAV Installation guide for further details on the functions used in this article.

Last updated: 15th June 2015 (LA/NT) 

Keywords: Zetadocs Customize

Equisys Logo, Document Management and Expense Management for Business Central

Replaced by script

ROI on expense management

Discover the return on investment you can benefit from by automating your expense management system, and download our infographic on the subject.

Read more