regarding servicenow translation in flow designer

venkyk1309
Tera Contributor

Hello Everyone,  @ankurbawisk , @Mark Roethof 
I have designed a flow designer i am taking the description from maintain item by using the script in the script box.. to remove the HTML tags.

var catItem = fd_data.trigger.request_item.cat_item;
var desc = catItem.description; // Strip HTML tags from the description
if (desc) {
var strippedDesc = desc.replace(/<[^>]*>/g, '').trim();
return strippedDesc;
}
return '';

I have used the above script it is working fine for the user whose language is English, the description is auto populating in English itself. While the user language is not English means (German, French, Dutch) the description field is populating in English only.

Note: 1. My maintain item is translated and it has translated texts as well.
2. When i impersonated the user, whose language is not English i can in the portal the description is visible in their language.

Thanks,
Venkatesh

3 REPLIES 3

Community Alums
Not applicable

Hi @venkyk1309,

You can use getDisplayValue() to retrieve the translated description:

var catItem = fd_data.trigger.request_item.cat_item;
var desc = catItem.getDisplayValue('description'); // Strip HTML tags from the description
if (desc) {
       var strippedDesc = desc.replace(/<[^>]*>/g, '').trim();
       return strippedDesc;
}
return '';

For more details, refer to this KB article: 

How to get field translated text from server script code - Support and Troubleshooting

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

Hi @Community Alums ,

Thank you for your response i have tried by using getDisplayValue() is not working in my flow designer script field, when i use that method total English translated description also disappearing.
I have refer to the KB article provided can you please provide the script for it ?

 

Thanks,
venkatesh

venkyk1309
Tera Contributor

Hi @Community Alums 

I have used the getDisplayValue() but still it is not working, if use this one the description which appear in English also disappearing now.
I have checked the KB article that you have shared could please provide a rough script for it ?

 

Thanks,
Venkatesh