- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2023 05:46 AM - edited 01-09-2023 02:48 AM
How to translate the Response Templates of Agent Workspace based on End user's language preference?
Please help me with possible solution..
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2023 10:24 PM - edited 01-07-2023 10:25 PM
To translate the Response Templates in the Agent Workspace, you can use the getMessage() global function and pass it the sys_id of the translation record. You can also use the gs.getMessage() function within a script include to get the translated message.
Here is an example of using the getMessage() function in a client script to set the value of a response template field:
//Get the sys_id of the translation record for the selected language
var translationSysId = gs.getUser().getPreference('language').sys_id;
//Get the translated message using the sys_id of the translation record
var translatedMessage = gs.getMessage('my_response_template', translationSysId);
//Set the value of the response template field to the translated message
responseTemplateField.setValue(translatedMessage);
You can also use the gs.getMessage() function within a script include to get the translated message and return it to the calling function.
function getTranslatedMessage(responseTemplate) {
//Get the sys_id of the translation record for the selected language
var translationSysId = gs.getUser().getPreference('language').sys_id;
//Get the translated message using the sys_id of the translation record
var translatedMessage = gs.getMessage(responseTemplate, translationSysId);
return translatedMessage;
}
Then, in your client script, you can call the getTranslatedMessage() function and pass it the name of the response template that you want to translate. The function will return the translated message, which you can then use to set the value of the response template field.
//Call the getTranslatedMessage() function and pass it the name of the response template
var translatedMessage = getTranslatedMessage('my_response_template');
//Set the value of the response template field to the translated message
responseTemplateField.setValue(translatedMessage);
To translate the response templates in Agent Workspace based on the end user's language preference, you can follow the below steps:
Create a translation table for the response templates which will contain the response template text and its translation in different languages.
In the response template form, add a new field called "Language" which will contain the language code (such as en, fr, de, etc.) for the response template text.
In the client script of the response template form, use the "g_form.getValue()" function to get the language code selected by the end user.
Use an AJAX call to query the translation table using the language code and the response template text as the filters.
Set the translated text as the value of the response template field using the "g_form.setValue()" function.
Make sure to add the necessary UI policies and client scripts to hide the language field and show the translated text to the end user.
By following these steps, the response templates will be automatically translated based on the language preference selected by the end user.
Kindly mark the response as Correct or Helpful.
Cheers,
Anish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2023 10:24 PM - edited 01-07-2023 10:25 PM
To translate the Response Templates in the Agent Workspace, you can use the getMessage() global function and pass it the sys_id of the translation record. You can also use the gs.getMessage() function within a script include to get the translated message.
Here is an example of using the getMessage() function in a client script to set the value of a response template field:
//Get the sys_id of the translation record for the selected language
var translationSysId = gs.getUser().getPreference('language').sys_id;
//Get the translated message using the sys_id of the translation record
var translatedMessage = gs.getMessage('my_response_template', translationSysId);
//Set the value of the response template field to the translated message
responseTemplateField.setValue(translatedMessage);
You can also use the gs.getMessage() function within a script include to get the translated message and return it to the calling function.
function getTranslatedMessage(responseTemplate) {
//Get the sys_id of the translation record for the selected language
var translationSysId = gs.getUser().getPreference('language').sys_id;
//Get the translated message using the sys_id of the translation record
var translatedMessage = gs.getMessage(responseTemplate, translationSysId);
return translatedMessage;
}
Then, in your client script, you can call the getTranslatedMessage() function and pass it the name of the response template that you want to translate. The function will return the translated message, which you can then use to set the value of the response template field.
//Call the getTranslatedMessage() function and pass it the name of the response template
var translatedMessage = getTranslatedMessage('my_response_template');
//Set the value of the response template field to the translated message
responseTemplateField.setValue(translatedMessage);
To translate the response templates in Agent Workspace based on the end user's language preference, you can follow the below steps:
Create a translation table for the response templates which will contain the response template text and its translation in different languages.
In the response template form, add a new field called "Language" which will contain the language code (such as en, fr, de, etc.) for the response template text.
In the client script of the response template form, use the "g_form.getValue()" function to get the language code selected by the end user.
Use an AJAX call to query the translation table using the language code and the response template text as the filters.
Set the translated text as the value of the response template field using the "g_form.setValue()" function.
Make sure to add the necessary UI policies and client scripts to hide the language field and show the translated text to the end user.
By following these steps, the response templates will be automatically translated based on the language preference selected by the end user.
Kindly mark the response as Correct or Helpful.
Cheers,
Anish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 11:05 PM
Thank you Anish Reghu for your valuable solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2023 03:41 AM
Welcome Santosh 🙂