Use the locale variable for multilingual surveys

Completed

For any organization that requests feedback, delivering content and communications to customers in their preferred language is important. Dynamics 365 Customer Voice provides the option to create multilingual surveys. If you create your survey by using multiple languages, a respondent is shown the right version automatically based on the language setting in their browser. Each survey will have a default language, based on the default language of the Microsoft 365 environment where Dynamics 365 Customer Voice is set up.

Adding more languages is a straightforward process. Access the functionality from the Customization menu from the right of any survey and then select the Languages option. The survey maker must then translate and update each additional language that is added. By using the Add language button, you can add languages to a survey. After you have added all the languages that you want, select the pencil icon next to a language, which will provide a new screen with the default language. This screen provides a column where you can add the translation for the new language that is being edited. A fast approach is to edit the languages in a Microsoft Excel file, which can then be uploaded. An Excel template can be downloaded and includes all questions that are added in the default language, with a column for each of the languages that are added to the survey.

A screenshot showing languages to use

With the additional languages added, if a match occurs between those languages and the language that is set on a respondent's browser, it will be the language that is displayed to them. You can also use a variable to determine which version should be displayed to the respondent when you send a survey or create an invitation by using one of the actions from the Dynamics 365 Customer Voice connector in Power Automate. The variable is one of three defaults that are added each time a new survey is created, and it can be deleted if it's not required. To use it, make sure that the variable is still in place, and if not, it can be added again with the variable name of locale.

A screenshot to show the Additional locales Francais and Deutsch, with an Add language button and an Upload button where you can upload your Excel file of translations.

To use the locale variable with success, a method must be set up to determine the preferred language for each customer. One approach is to add a new language choice column to the contact record in the same Microsoft Dataverse environment where your projects and surveys have been created. When the choice column is complete, note the value that is assigned to each added language. For example, the first language that is added might be French, and the value that is assigned to this label might be 916,780,000, with additional languages having a value increment by 1 each time. Save the values in Notepad but remove the commas. This column can then be used to identify the preferred language for an individual.

You can use several approaches when structuring a flow in Power Automate, but in this example of using the locale variable, assume that a case has been closed, which will trigger the flow to run. It's important that a Get record action step from the Microsoft Dataverse connector is used to get the contact that is related to the case. Next, a Compose action step is required so that the locale can be translated from the language on the contact record.

The flow step to get language from locale.

Use the custom column name that was previously added to add a required expression along with the value for each language that was added to the choice column. The following example shows how to format the expression. An if statement is needed for each language that a contact could possibly have from the choice column. After the value, the correct language code needs to be used. To be sure that the correct code is used, download the Excel translations file from the Languages section on the survey in Dynamics 365 Customer Voice; the code for additional languages is at the top of each column.

if(equals(outputs('Get_Contact')?['body/custom_column'],916780000),'fr', if(equals(outputs('Get_Contact')?['body/custom_column’],916780001),'de', 'en-gb')))

The Compose step has an output, which is one of the locale codes that are set in the expression. The Outputs parameter is then added to the locale column from the dynamic content area and included in either a Create an invitation step or a Send a survey step in the flow. After the flow has been triggered, and a recipient is sent a link to the survey by email or some other mechanism, selecting the link will take them to the survey that is displayed in their preferred language.

A screenshot to define the output of the flow.