Set user criteria on widget based on user language settings

kpanchal
Tera Contributor

Hello,

I want to set a user criteria for my "Contact Us" widget based on the user language settings.

For eg: If it's French - Canada it's visible and if it's English, it's not visible. For the English one, it's the reverse

How can I achieve it?

 

 

kpanchal_0-1695147413817.png

 

1 REPLY 1

Peter Bodelier
Giga Sage

Hi @kpanchal,

 

Below could still be useful, but I think not useable for preferred language.

 

Try an advanced script:

var user = new GlideRecord('sys_user');
user.get('user_name', user_id);

answer = user.getValue('preferred_language') == 'fr';
answer;

 

 

Spoiler

Take a look at this:

Extend user criteria (servicenow.com)

You can simply add fields from the user record to the user criteria, which can then be leveraged. This way you can take advantage of the preferred_language field on the user record.

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.