The CreatorCon Call for Content is officially open! Get started here.

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

1 REPLY 1

M Iftikhar
Giga Sage

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.