language translation in catalog client script

ujjwal0306
Giga Expert

In the Service Catalog Variable XYZ values are dependent on the variable ABC values. To populate the values in XYZ dynamically I've used a catalog client script. I did not create any choice in catalog items for XYZ. Now the requirement is the variables need to be translated in different languages. I've translated most of them but the choice list in XYZ is not translated as they are dynamically created using catalog client script. How to translate the values in the catalog client script in different languages?

1) We can do it manually by scripting the translated choice list. But, it is time consuming.

Is there any way to achieve this?

Note: Values in XYZ are visible based on the values selected in ABC. Catalog script is used to display those values.

1 ACCEPTED SOLUTION

This was not working. But I figured out a way to translate the dynamic variables, we can translate it in the messages and use getMessage(); the values can   be translated.


View solution in original post

7 REPLIES 7

Lon Landry3
Giga Expert

I have used an undocumented API to achieve this in the past:

g_lang (works in both client and UI Policy scripts)

I have a super detailed presentation on translations if you are interested, but it is focused on custom scoped apps.

poojitha bn
Giga Expert

Hi Lon Landry,

Thanks for the reply.

below code working for me :

else if(newValue == "Employee Data Change"){
getMessage('Employee data change', function(msg){
g_form.addOption('u_category_2', msg , msg );
});
}

Sri Bhavani
ServiceNow Employee
ServiceNow Employee

Hi Poojitha, may I know if you add that message to be translated in the 'sys_ui_message' table with key as 'Employee data change' ? Can you please elaborate on what you did other than this script?