change scripting of User Criteria to get the user.language from sys_user_preference table

Stan24
Tera Contributor

Hello everybody,

 

I don't have any scripting knowledge so I'm reaching out to you! Thank you in advance for checking my post!

 

The Problem:

The user criteria in our knowledge base are based on the preferred_language of the user from the sys_user table.

The problem is that if a user changes his language manually, the language of the instance changes, but the articles remain in the language of the sys_user table. The articles need to be  in the same language as the one the employee has chosen  (stored in user.language in the sys_user_preference table).  

 

scrip how it is now for the dutch user criteria:

isDutch();

function isDutch() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
language = String(user.preferred_language);
if (language == 'nl')
return true;
else
return false;
}

 

How do I change the code so it takes the values of the user.language from the sys_user_preference table?

It's probably something very simple but I just can't seem to figure it out.  

You will have my eternal gratitude for helping me out!

 

KR,

Stan

 

 

 

0 REPLIES 0