How to get the translated states and stages in choice list table for notifications

lawrencesenpai
Tera Contributor

What is the best approach to get the translated states and stages from the choice list table and use it on the notifcations.

lawrencesenpai_0-1714797433104.png

 

7 REPLIES 7

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @lawrencesenpai 

Enable language debugger to find which table they fall under.

 

find more about translation tables here:

https://www.servicenow.com/community/international-localization/everything-you-ever-wanted-to-know-a...

 

 

Please mark this answer as helpful and correct if helped

Kind Regards,

Ravi Chandra.

I use this to translate the labels for the notifcations so it will be translated to the preferred language of the user. However on the notifcations, if I use this ${priority}  it still gives the english one instead of the translated in the choice list. So do I need to create a new notifcation script and use that instead? Thanks!

Sandeep Rajput
Tera Patron
Tera Patron

@lawrencesenpai You can use getDisplayValueLang method available in GlideElement class to get a translated choice from table.

 

Here is the description of this method.

Screenshot 2024-05-04 at 11.30.42 AM.png

Here is the example.

 

var uiView = new GlideRecord("sys_ui_view");
uiView.get("fa776f6d97700100f309124eda2975bc");
gs.info("getDisplayValueLang: " + uiView.getElement("title").getDisplayValueLang("de")); //Display value in German

 

Please refer to this link for more information https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server_legacy/c_GlideElementAPI#GE...

So if I use this one, I need to create a notification script and use it on the notifcations instead of the normal {$State} code?