- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi everyone,
I am trying to use getMessageLang in sys_script_email which was previously having getMessage
let printText = sn_i18n.Message.getMessage('scope_name',
'<p><span style="font-size: 12pt; font-family: Gilroy, century-gothic;">' +
'{assignedUser} has assigned you the {taskName} <strong>{taskDescription}</strong> in workspace.' + ' </span></p><p><span style="font-size: 10pt; color: #454D5B;">' + '{taskSpaceName} | {taskBoardName} | Work management' + '</span></p><br>',{
taskName: current.type.name,
assignedUser: assignedBy,
taskDescription: current.short_description,
taskSpaceName: spaceName,
taskBoardName: boardName
}
);
Can we use getMessageLang directly when we have inline styling?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Could you Please accept the solution, if it solves your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Suchitha Challa ,
Yes, you can use getMessageLang with inline styling exactly as you do with getMessage Just add the language code argument. But it’s cleaner to move the HTML template into a message record and keep only the key in your script.
let printText = sn_i18n.Message.getMessageLang(
'scope_name',
'<p><span style="font-size: 12pt; font-family: Gilroy, century-gothic;">' +
'{assignedUser} has assigned you the {taskName} <strong>{taskDescription}</strong> in workspace.' +
' </span></p><p><span style="font-size: 10pt; color: #454D5B;">' +
'{taskSpaceName} | {taskBoardName} | Work management' +
'</span></p><br>',
'en',
{
taskName: current.type.name,
assignedUser: assignedBy,
taskDescription: current.short_description,
taskSpaceName: spaceName,
taskBoardName: boardName
}
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Could you Please accept the solution, if it solves your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I tried using gs.getMessageLang directly and it worked instead of sn_i18n.Message.getMessageLang with the inline styling and scope passed as parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
yes it should.
you are already doing that.
Did it not work fine?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader