Add welcome message to Service Portal with Name

Dan Brown2
Kilo Sage

Hi,

I can't find a definitive answer on how to add the user's name to the Welcome message on the Service Portal. so as Below, but Hi Dan - how can we help?

 

DanBrown2_0-1681916286891.png

Can someone please advise the best way?

Many thanks,

Dan

 

1 ACCEPTED SOLUTION

pat222
Tera Expert

Hi Dan,

 

according to this KB article you can do the following:

 

  1. Clone the Homepage Search widget 
  2. In the cloned widget, change the client controller as follows

 

function() {

  /* widget controller */

  var c = this;

  c.data.greeting = 'Hi ' + scope.user.first_name; 

}

 

3. Change your Angular ng-bind value in the HTML template to data.greeting.

 

<h1 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="data.greeting"></h1>

 

 

Best regards,

Patrick

View solution in original post

2 REPLIES 2

pat222
Tera Expert

Hi Dan,

 

according to this KB article you can do the following:

 

  1. Clone the Homepage Search widget 
  2. In the cloned widget, change the client controller as follows

 

function() {

  /* widget controller */

  var c = this;

  c.data.greeting = 'Hi ' + scope.user.first_name; 

}

 

3. Change your Angular ng-bind value in the HTML template to data.greeting.

 

<h1 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="data.greeting"></h1>

 

 

Best regards,

Patrick

cczernia
Mega Guru

You could create a custom widget.

 

In the Server Script use :
data.firstName = gs.getUser().getFirstName();

 

In the Body Html template use

<div>Hi {{c.data.firstName}}, How can I help?</div>

 

Then add the widget to your page.