- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2016 11:52 PM
Hi all,
Is it any simple way on the new Self service portal for adding the language option on the login page as we have on the backend?
thanks in advance
Regs,
Lô Mouhamadou
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2016 11:48 AM
I completed a widget solution that ties into the Service Portal Header.
- Import the widget record that is attached to this reply
- Navigate to your header
- Find the following code in the Body HTML Template:
<ul ng-if="::user.logged_in" class="nav navbar-nav">
<!-- chat, avatar, and logout -->
<li ng-if="::data.connect_support_queue_id"><a href ng-click="openPopUp()">${Live Chat}</a></li>
<li class="dropdown hidden-xs">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
<span class="navbar-avatar"><sn-avatar class="avatar-small-medium" primary="userID" /></span>
<span class="visible-lg-inline">{{::user.name}}</span>
</a>
Add the following code (to line 4):
<li><sp-widget widget="data.languagePicker"></sp-widget></li>
Navigate down to Server Script and add the following line.
data.languageSelector = $sp.getWidget("language-picker", {});
The end result will look like this:
Please let me know if you any more help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 03:22 PM
Yes, it has to do with the refresh time of the page. You need to add a timer, I will update the widget and send you the code in this thread in a little bit.
-Brett Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016 01:42 AM
Hi Karl,
good idea again, it worked, thanks! (I put the $window.location.reload() into the timeout function:
function ($scope, $window, $timeout) {
$scope.setLanguage = function(value) {
$scope.data.newLanguage = value;
$scope.server.update();
$timeout(function() {
$window.location.reload();
},500);
};
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2017 03:30 PM
Hi Brett,
Have you managed to get your language picker to change a user's language before login?
I have users logging in to a system without SSO and need various language options on the portal login page, and I've been having issues with using setPreference on non logged in users:
user.setPreference("user.language", input.newLanguage);
Does not appear to work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2017 04:43 PM
What I've actually found is that it seems the angular server update seems to fail for non-logged in users. So the input is never passed in to update preferences. If I hardcode a preference change, that works for a non-logged in user.
I'm getting the following errors in my console:
GET https://blah.service-now.com/angular.do?sysparm_type=get_user 401 (Unauthorized)
(anonymous) @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11200
sendReq @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11063
serverRequest @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:10988
processQueue @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:13849
(anonymous) @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:13864
$eval @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:14422
$digest @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:14329
$apply @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:14449
done @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11104
completeRequest @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11216
requestLoaded @ js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11171
js_includes_sp.jsx?v=11-18-2016_1553&lp=Wed_Feb_01_08_49_42_PST_2017&c=10_51&lang=ga:11973 (authIntercepter) User has been logged out
I wonder if there is some other way to pass the info to the server?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 03:28 AM
Hi Brett,
You can't use setPreference in this case as the user is not logged in.
I managed to build the functionality so I will share later the script.