When switching language in the portal the language should get updated in user profile as well.

Akula M S G Dev
Tera Contributor

When switching language in the portal the language field  should get updated in user profile as well. How can we achieve this

 

1 REPLY 1

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Akula M S G Dev 

Changing the language changes the user preference.

You can write insert/update Business Rule on User Preference table. (When the name is user.language)

(function executeRule(current, previous) {

    //Update the user's profile language based on user preference

    gr = new GlideRecord('sys_user');

    gr.addQuery('user_name', current.user.user_name);

    gr.query();

    while (gr.next()) {

        gr.preferred_language = current.value;

        gr.update();

        }

})(current, previous);

 

Please mark the answer as correct solution and helpful if helped.

Kind Regards,

Ravi Chanda