How can i get the Employee Home page search widget to include logged in users name

DevtoSME
Giga Guru

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

7 REPLIES 7

Sid_Takali
Kilo Patron
Kilo Patron

Hi @DevtoSME Refer below Screenshots and use below code

1. Client Controller

SiddharamTakali_0-1715402564018.png

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

SiddharamTakali_1-1715402673560.png

<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>

 

SiddharamTakali_2-1715402737132.png

 

Please mark my Reply Correct/Helpful,

Regards,

Sid

 

 

Good afternoon,  

 
 thank you so much for responding. this has ben very time consuming. i applied both codes to the html and client script but the widget is not showing up in the preview pan. the H1 a the end is in red I'm not sure i that's significant but can you let me know if I'm missing anything. This task is due next week

Gangadhar Ravi
Giga Sage
Giga Sage

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>