Hiding Short Description based on User Language

sravanku888
Tera Contributor

how to configure ServiceNow to hide the short description of a catalog item when the user's language is Spanish

8 REPLIES 8

Hi @Ankur Bawiskar 

Thanks for your response. I tried the solution you provided, but it didn't work as expected. I would like to hide the "Short description" on the portal when the user's language is Spanish, which is highlighted in red. Could you please provide any other solutions?

sravanku888_0-1747640583595.png

 

@sravanku888 

then it's not possible without DOM

Do this

1) have a variable of type HTML or Rich Text and show that short description inside that

2) then use the script I shared to hide it based on language

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar 

Thanks for your response. I tried the solution you provided, but it didn't work as expected. I would like to hide the "Short description" on the portal when the user's language is Spanish, which is highlighted in red. Could you please provide any other solutions?

sravanku888_0-1747640299241.png

 

Gaurav Rathaur
Kilo Guru

Hi @sravanku888 ,

 

You can achieve your desired outcome by using two methods:

 

Solution 1: Using OnLoad Client Script

You can use an OnLoad client script on your catalog item to hide a variable based on the user's language. Here's a sample script:

 

 
function onLoad() {
    var userLanguage = g_lang;
    if (userLanguage == 'es') {
        g_form.setDisplay('variableName', false);
    }
}
 

This script checks the user's current language (e.g., 'es' for Spanish) and hides the specified variable if the condition is met. Make sure to replace 'variableName' with the actual name of your variable.


Solution 2: Using UI Policy

Alternatively, you can achieve this using a UI Policy for better maintainability:

  1. Create a UI Policy on the catalog item.

  2. Set the Conditions as:

    • Requested for.language = Spanish

  3. In the UI Policy Actions section, set the desired variable to Hidden.

This approach is more admin-friendly and keeps your business logic in a centralized place.

 

If my response was helpful, please mark it as the correct answer and close the thread. This will help others who come across the same issue.

Thanks!
Gaurav Rathaur