Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Dynamic Translation Button not appearing beside field

Amol Itankar
Kilo Contributor

I am working on dynamic text translation. I have followed all the required steps like

1. Creating Credential

2. Creating Connection

3. Configuring Dictionary for field

4. Set User Default Language

Please help me. I am new to service now.

15 REPLIES 15

Z_ Pedro Abreu
Tera Contributor

Hi,

Please be aware that field dynamic translation only works for some field types and uses as the target language the current user session language. Supported field types are:

  • String
  • String (Full UTF-8)
  • Multi Line Small Text Area
  • Wide Text

 

For other field types you can create a client side UI Action that displays the result in a field message. Something like the code below should do the trick.

 

//Shows the translation of the 'meta' field on the form
function translateMeta() {
    var response = {};
    var parms = {};

    parms['targetLanguages'] = [g_form.getValue('language')];

    DynamicTranslation.getTranslation(g_form.getValue('meta'),  parms).then(
        function(response) {
            g_form.hideFieldMsg('meta');
            g_form.showFieldMsg('meta',  response.translations[0].translatedText + " [" + response.translator + "]");
        },
        function (err) {
            g_form.showFieldMsg('meta',  JSON.stringify(err), 'error');
        }
    );
}


Hope this helps,

 

Regards,

 

José Pedro Abreu