Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add welcome message and your name to Service Portal

Samiksha_12
Tera Contributor
 
2 REPLIES 2

Clara Lemos
Mega Sage

Hi @Samiksha_12 ,

 

Check out this knowledge article : Solved: Add welcome message to Service Portal with Name - ServiceNow Community

 

If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know

Cheers

smitaD
Tera Contributor

use  below code

 

api.controller = function() {
/* widget controller */
var c = this;
var today = new Date();
var curHr = today.getHours();
if (curHr < 12) {
c.data.greeting = 'Good morning ' + scope.user.first_name+ ' ' + scope.user.last_name;
} else if (curHr < 18) {
c.data.greeting = 'Good afternoon ' + scope.user.first_name+ ' ' + scope.user.last_name;
} else {
c.data.greeting = 'Good evening ' + scope.user.first_name+ ' ' + scope.user.last_name;
}
};

 

Please mark as helpful if works.