Translation Issue

mouradhadj-
Tera Contributor

Hi,

I'm having trouble translating a message inside a Business Rule. I used gs.getMessage() along with the sys_ui_message table to store the translations, but the message is still not being translated in french.

this is my BR: 

 var ritmGrp = new GlideRecord('sc_req_item');
    ritmGrp.addQuery('sys_id', current.parent);
    ritmGrp.query();
    if (ritmGrp.next()) {
      var reqMessage = gs.getMessage(
            "Your request is waiting for approval by '{0}'",
            [' ' + current.assignment_group.name + ' ' + ' (' + current.assignment_group.u_short_description + ')']
        );
        ritmGrp.comments.setJournalEntry(reqMessage);


did some one know why ?

Thankx!!!!!
10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@mouradhadj- 

try this

 

If my re

 var ritmGrp = new GlideRecord('sc_req_item');
 ritmGrp.addQuery('sys_id', current.parent);
 ritmGrp.query();
 if (ritmGrp.next()) {

     var reqMessage = gs.getMessageLang(
         "Your request is waiting for approval by '{0}'", "fr",
         [' ' + current.assignment_group.name + ' ' + ' (' + current.assignment_group.u_short_description + ')']
     );
     ritmGrp.comments.setJournalEntry(reqMessage);
 }

sponse helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@mouradhadj- 

it worked for me using the sample script I shared

 var ritmGrp = new GlideRecord('sc_req_item');
 ritmGrp.addQuery('sys_id', current.parent);
 ritmGrp.query();
 if (ritmGrp.next()) {

	// get the language of logged in user and then use it in below line
     var myUserObject = gs.getUser();
     var lang = myUserObject.getLanguage();

     var reqMessage = gs.getMessageLang(
         "Your request is waiting for approval by '{0}'", lang,
         [' ' + current.assignment_group.name + ' ' + ' (' + current.assignment_group.u_short_description + ')']
     );
     ritmGrp.comments.setJournalEntry(reqMessage);
 }

AnkurBawiskar_0-1742391251656.png

AnkurBawiskar_1-1742391262480.png

 

AnkurBawiskar_2-1742391276155.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

mouradhadj_0-1742392495012.png

Still don't work !!!

BR: 


    var ritmGrp = new GlideRecord('sc_req_item');
    ritmGrp.addQuery('sys_id', current.parent);
    ritmGrp.query();
    if (ritmGrp.next()) {


        var reqMessage = gs.getMessage(
            "Your request is waiting for approval by '{0}'","fr",
            [' ' + current.assignment_group.name + ' ' + ' (' + current.assignment_group.u_short_description + ')']
        );

        ritmGrp.comments.setJournalEntry(reqMessage);

        // ritmGrp.comments = reqMessage + current.assignment_group.name + '(' + current.assignment_group.u_short_description + ')' ;
        ritmGrp.update();
    }

@mouradhadj- 

you didn't use the function I shared and the exact script

use this

var ritmGrp = new GlideRecord('sc_req_item');
 ritmGrp.addQuery('sys_id', current.parent);
 ritmGrp.query();
 if (ritmGrp.next()) {

	// get the language of logged in user and then use it in below line
     var myUserObject = gs.getUser();
     var lang = myUserObject.getLanguage();

     var reqMessage = gs.getMessageLang(
         "Your request is waiting for approval by '{0}'", lang,
         [' ' + current.assignment_group.name + ' ' + ' (' + current.assignment_group.u_short_description + ')']
     );
     ritmGrp.comments.setJournalEntry(reqMessage);
 }

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader