Translate text in Email script

Uttam Sai
Tera Contributor

Hi Team,
Could you please help me how to use "gs.getMessage()" for the below part of email script to Translate to other Languages.

template.print('<div>Hello ${task.assigned_to.name},</div><div>&nbsp;</div><div>This is a friendly reminder that your task "${task.u_activity_type}" on ${task.parent.number} still requires your action. Please take the required actions, then complete this task as soon as possible in the ServiceNow portal.</div><div>&nbsp;</div><div>You can access your onboarding case from the link below to complete your task.</div>');
}
 
2 REPLIES 2

Manmohan K
Tera Sage

Hi @Uttam Sai 

 

Go to System UI> Messages and create your translated messages. For example,

 

key=first_msg

Message= This is a friendly reminder that your task {0} on {1} still requires your action. Please take the required actions, then complete this task as soon as possible in the ServiceNow portal

 

Now use below code in mail script to create translated message

var msgArray = [];

// Put the dynamic parts of the message in an array
msgArray.push(task.u_activity_type);
msgArray.push(task.parent.number);

var msg = gs.getMessage('first_msg', msgArray);

 

For details on translating messages, refer below article

https://www.servicenow.com/community/in-other-news/gs-getmessage-the-second-parameter/ba-p/2279603

Tushar
Kilo Sage
Kilo Sage

Hi Sai,

 

something like this ?

 

template.print('<div>' + gs.getMessage('email.greeting', [task.assigned_to.name]) + '</div><div>&nbsp;</div><div>' + gs.getMessage('email.reminder', [task.u_activity_type, task.parent.number]) + '</div><div>&nbsp;</div><div>' + gs.getMessage('email.accessLink') + '</div>');

 


Mark as correct and helpful if it solved your query.

Regards,
Tushar