Skip to content

Commit 06dd568

Browse files
Create GreetingMessage.js
We want to display a friendly greeting message to the user whenever they open the Incident form in ServiceNow. The greeting should change depending on the time of the day.
1 parent dabc9d1 commit 06dd568

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
// Type: onLoad | Table: incident
3+
function onLoad() {
4+
var hr = new Date().getHours();
5+
var msg = (hr < 12) ? "Good Morning!" : (hr < 18) ? "Good Afternoon!" : "Good Evening!";
6+
g_form.addInfoMessage(msg + " Please provide the details of your issue.");
7+
}

0 commit comments

Comments
 (0)