Set language filter in backend to show articles in Service Portal ONLY in user's set language

Melinda7
Kilo Expert

Can someone please give me advice on how to implement a language filter on the backend in order to show only those Knowledge articles to end user that are in his set language?

I mean if the user's language set in his profile in the backend is English, only English KB articles will be shown to him on Service Portal.

As mentioned, this needs to be implemented in the backend.

Thank you.

1 ACCEPTED SOLUTION

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Lili Ivany no worries,

So the second picture is similar to the ootb "Create Incident" Record Producer,

I've just tried it on one of my instances and what I'm about to propose works for this specific search use-case as it's only filtering against the search from the Record Producer and in theory nothing else, however further testing would be required to make sure it doesn't restrict other places just to be 100% safe,

Searching before anything changed (shows all results):
find_real_file.png

Find the "Search Context" for your Record Producer, my example looks like this:
find_real_file.png

Go into the related list of "Record Producer Configurations" specifically into the record of your RP (mine is "Create Incident", so I'd imagine yours based on your screenshot is "Report an Issue"):
find_real_file.png
* You won't have a filter configuration listed necessarily, you'll need to create one like the following:
find_real_file.png
* As you create the new record, the script won't be editable so just "save" then add the line I have highlighted

Test your search on the Record Producer and it should work, example with an English user:
find_real_file.png
example with a French user (as I have a French Article related to the English source):
find_real_file.png

Many thanks,
Kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

View solution in original post

8 REPLIES 8

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Lili Ivany, if you are referring to the UI16 view of Knowledge, then there should be a language picker for the articles in the filter section already. However, since NewYork I think (I can't remember which release we introduced this change off the top of my head), if you go to "Knowledge" > "Homepage" it now renders as the /kb portal, which has a really handy language picker widget when there are articles made in other languages:

find_real_file.png

This widget is also property driven, which allows either one language to be selected at a time, or multiples as you can see in the image above. The property should be "glide.knowman.enable_multi_language_search",

Top tip, this widget is also super handy for integrating into other portals, details on how can be found here

Many thanks,
kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

Hi @Alex Coope 

Thank you for your suggestion. I feel I did not provide the full explanation of what I need to have done. I use the contextual search in a field under my incident form on frontend, where, if you type in the 'short description of your issue' field, knowledge base articles that include the given typed word appear in the 'search results' below.

So it is here, where I need to have the given articles already filtered according to the preferred language of the end user.

I have tried to set the 'Search Resource Context Property' condition's value as:

 

kb_knowledge_base=58aa42a7db61b3005c437ecaae96198b^languageSAMEASjavascript:gs.getSession().getLanguage()

 

or

 

'kb_knowledge_base=58aa42a7db61b3005c437ecaae96198b^language='+gs.getSession().getLanguage()

 

But none of them worked...

 

find_real_file.png

find_real_file.png

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Lili Ivany no worries,

So the second picture is similar to the ootb "Create Incident" Record Producer,

I've just tried it on one of my instances and what I'm about to propose works for this specific search use-case as it's only filtering against the search from the Record Producer and in theory nothing else, however further testing would be required to make sure it doesn't restrict other places just to be 100% safe,

Searching before anything changed (shows all results):
find_real_file.png

Find the "Search Context" for your Record Producer, my example looks like this:
find_real_file.png

Go into the related list of "Record Producer Configurations" specifically into the record of your RP (mine is "Create Incident", so I'd imagine yours based on your screenshot is "Report an Issue"):
find_real_file.png
* You won't have a filter configuration listed necessarily, you'll need to create one like the following:
find_real_file.png
* As you create the new record, the script won't be editable so just "save" then add the line I have highlighted

Test your search on the Record Producer and it should work, example with an English user:
find_real_file.png
example with a French user (as I have a French Article related to the English source):
find_real_file.png

Many thanks,
Kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

Thank you so much, @Alex Coope !

In the meantime I realized, even maybe my condition filter worked correctly, but there is a problem in the settings of some of the articles, e.g. there is an article written in German, but it's set as an article in English 😮

And the listed articles (thanks to this wrong setting) still listed all articles that were written in both languages.

find_real_file.png

Thank you so so much for your help, highly appreciated! All the best, 

Lili