Translate text in Email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 07:31 AM
Hi Team,
Could you please help me how to use "gs.getMessage()" for the below part of email script to Translate to other Languages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 08:01 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 08:10 AM
Hi Sai,
something like this ?
template.print('<div>' + gs.getMessage('email.greeting', [task.assigned_to.name]) + '</div><div> </div><div>' + gs.getMessage('email.reminder', [task.u_activity_type, task.parent.number]) + '</div><div> </div><div>' + gs.getMessage('email.accessLink') + '</div>');
Mark as correct and helpful if it solved your query.
Regards,
Tushar