Service Portal add current user's name i.e. "Hi Joe, How Can We Help?"

reginabautista
Kilo Sage

Hi guys how can we add the current user's name to the "How Can We Help?" message on the main SP page? Please refer to attached screenshot. Thanks - Regina

1 ACCEPTED SOLUTION

For the newly cloned widget...



Just write the below line in the Server part:



data.user = gs.getUserName();



View solution in original post

21 REPLIES 21

What is your server script?


var typeAheadSearchOpts = {title: gs.getMessage('How can we help?'), size: 'lg', color: 'default'};


data.typeAheadSearch = $sp.getWidget('typeahead-search', typeAheadSearchOpts);


Try



(function() {




  // Collect the User Info to Display Users First Name


   


      data.sysUserID = gs.getUserID();


              if (!data.sysUserID)


                                        data.sysUserID = gs.getUser().getID();


      var sysUserGR = new GlideRecord("sys_user");


      data.userExists = sysUserGR.get(data.sysUserID);



      if (data.userExists) {


              data.name = sysUserGR.getValue("first_name");


      } else {


              data.name = "User";


      }    



  // Include the Search Bar widget as part of this Widget



  var typeAheadSearchOpts = {title: gs.getMessage('How can we help?'), size: 'lg', color: 'default'};


data.typeAheadSearch = $sp.getWidget('typeahead-search', typeAheadSearchOpts);



})();


Thanks Derek, no luck!


For the newly cloned widget...



Just write the below line in the Server part:



data.user = gs.getUserName();