Multi language notifications

Madhavi2
Tera Contributor

Hi,

I am having a requirement where I need to translate my English notification to German and Dutch.

I found that we can do this by creating separate language based notifications with the single event.

But my English notification is going to Requestor, Requested for and watchlist. 

Do we need to create separate notifications for each recipient i.e Requestor , Requested for like that. Or can we handle with single language notification?

Also how can we send language based notification to watchlist members?

Thanks,

Madhavi

 

8 REPLIES 8

Hi,

You can try script in mail script something like below:

var item = new GlideRecord("sc_req_item");
item.addQuery("request", 'f7c34c96db96bb00d936320a689619c2');
item.query();
while(item.next()) {
	gs.print("Summary of RITM variables:");
	var keys = [];
	var set = new GlideappVariablePoolQuestionSet();	
	set.setRequestID(item.sys_id);
	set.load();
	var vs = set.getFlatQuestions();
	for (var i=0; i < vs.size(); i++) {
		if(vs.get(i).getLabel() != '') {
			var IT_LBL= geti18Label('IT',vs.get(i).getLabel());
			var EN_LBL=vs.get(i).getLabel();
			var IT_VAL=geti18Value('IT',vs.get(i).getDisplayValue(),vs.get(i).getType()+'');
			var EN_VAL=vs.get(i).getDisplayValue();
			gs.print(EN_LBL+"(IT: "+IT_LBL+"):::::"+EN_VAL+"(IT: "+IT_VAL+")");

		}//immediate for if block
	}//for loop
}//while loop

function geti18Label(lang,lbl)
{
	var target = new GlideRecord('sys_translated');
	target.addQuery('language', lang);
	target.addQuery('name', 'question');
	target.addQuery('element', 'question_text');
	target.addQuery('value', lbl);
	target.query();
	if(target.next()) {
		return target.label;
	}
	else
	{
		return lbl;
	}
}

function geti18Value(lang,val,type)
{
	var tar = new GlideRecord('sys_translated');
	tar.addQuery('language', lang);
	tar.addQuery('name', 'question_choice');
	tar.addQuery('element', 'text');
	tar.addQuery('value', val);
	tar.query();
	if(tar.next() && type=='5' ) {
		return tar.label;         
	}
	else
	{
		return val;
	}
}

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

Regards,
Saurabh


Thanks and Regards,

Saurabh Gupta

Maik Skoddow
Tera Patron
Tera Patron

Hi @Madhavi 

ServiceNow proposes the following https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0715187

And at https://community.servicenow.com/community?id=community_question&sys_id=0ce7472ddb1cdbc01dcaf3231f96... you will find an approach for a custom version of gs.getMessage() which considers language of the recipient.

Kind regards
Maik

Mark Roethof
Tera Patron
Tera Patron

Hi there,

There's not a good out-of-the-box solution for this.

I do see a reply here concerning notifications for different languages, I see this used at several customers also. Though because your language is for example Spanish, does not mean the recipient language is also Spanish.

Or what if you are sending an email to a watchlist, a watchlist with people with different preferred languages...

You could create a notification with use of gs.getMessageLang(), with that you can specify the language of the message. So you could query for the language of the recipient, though obviously that notification then can only go to one specific recipient. Also using gs.getMessageLang, would require all your text that you need to translate, to be in UI Messages.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Deepak Negi
Mega Sage
Mega Sage

Try this if there is 1 recipient, e.g Assigned to, Caller etc

 

Multilingual Notifications- NOW made easy! - Now Platform - Article - ServiceNow Community

 

Regards

Deepak