How can i get the Employee Home page search widget to include logged in users name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 11:25 AM
I need to include the logged in users name in the homepage search bar so it can say something like
"Hello John, how can i help you"
i have seen a few community post with server side script but it does not include the original server widget code that has the asisearch enabled. As i am not js proficient i would like to know what all should be included in the server script and html
any help would be appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 09:44 PM
Hi @DevtoSME Refer below Screenshots and use below code
1. Client Controller
api.controller = function() {
/* widget controller */
var c = this;
c.data.greeting = 'Hi ' + scope.user.first_name + ', How can we help you?';
};
2. HTML Body Template
<div id="homepage-search" class="hidden-xs wrapper-xl">
<div class="wrapper-xl">
<h2 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="data.greeting"></h1>
<!-- <h2 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="options.title"></h2> -->
<div ng-if="options.short_description" class="text-center h4 m-b-lg sp-tagline-color" ng-bind="options.short_description"></div>
<sp-widget widget="data.typeAheadSearch"></sp-widget>
</div>
</div>
Please mark my Reply Correct/Helpful,
Regards,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2024 12:28 PM
Good afternoon,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 04:01 PM
you need add this in client script.
api.controller=function() {
/* widget controller */
var c = this;
c.data.greeting = 'Hi ' + scope.user.first_name;
};
and in HTML change your Angular ng-bind value data.greeting.
<h1 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="data.greeting"></h1>