Glide System
Glide System
Glide System
SERVICENOW BUDDIES
GLIDE SYSTEM
—
What is Glide System?
Glide System
Methods
Glide System
addInfoMessage() endOfLastMonth()
addErrorMessage() endOfLastWeek()
getUser() endOfLastYear()
getUserName() endOfNextMonth()
getUserID() endOfNextWeek()
getUserDisplayName() endOfNexYear()
hasRole() endOfThisYear()
error() endOfThisQuarter()
eventQueue() endOfThisMonth
eventQueueScheduled() hoursAgo()
generateGUID() hoursAgoEnd()
getErrorMessage() hoursAgoStart()
getSession() minutesAgoEnd()
getSessionID() minutesAgoStart()
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 1/15
11/24/22, 7:02 AM Glide System
include() monthsAgo()
Info() monthsAgoStart()
isDebugging() nil()
isInteractive() yearsAgo()
isLoggedIn() yesterday()
isMobile() Warn()
setProperty() tableExists()
setRedirect() getAvatar()
Practically Work with these all methods
2.
Open Scripts –
Background Application
3.
Write code into given space
1. Working
with addInfoMessage () method
This method is used to add an info message for the current session.
This method is not supported
for asynchronous business rules.
Example: 2
2. Working
with addErrorMessage ()
method
This method is used to add an error
message for the current session.
3. Working
with getUser () method
Returns a reference to the user
object for the current user.
var currentUser =
gs.getUser();
gs.print(currentUser.getEmail());
4. Working
with getUserDisplayName ()
method
Return current user
display name
gs.print
(gs.getUserDisplayName ());
5. Working
with getUserID () method
Return current user sys_id
gs.print (gs.getUserID ());
6. Working
with getUserName () method
Display current user user name
7. Working
with getUserNameByUserID ()
method
Returns the username based on a user
ID.
8. Working
with hasRole () method
Define if the current user has at
least one of the role assigned to current user
9. Working
with hasRoleInGroup () method
Define if the current user has the
specified role within a specified group.
group.addQuery ('name',
'software');
group.setLimit (1);
group.query ();
if (group.next ()) {
} else {
}
10. Working
with isInteractive () method
It will checks if the current session
is interactive or not
1.
Interactive session is when a user logs in using the service
now log-in screen
2.
Non-interactive session is using a SOAP request to retrieve data from servicenw
platform.
Example:
2
11. Working
with getAvatar () method
Displays the file path to the current
user's avatar.
gs.addInfoMessage ('User
avatar ID: ' + userPhoto);
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 4/15
11/24/22, 7:02 AM Glide System
12. Working
with flushMessags () method
This method will clears all session
messages saved using addErrorMessage
() or addInfoMessage ().
gs.flushMessages ();
gs.print
(gs.beginningOfLastMonth ());
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 5/15
11/24/22, 7:02 AM Glide System
gs.print (gs.beginningOfThisWeek());
gs.print (gs.beginningOfThisYear());
gs.print (gs.beginningOfToday());
gs.print (gs.beginningOfTomorrow());
gs.print (gs.daysAgo(4));
gs.print (gs.daysAgoEnd
(10));
gs.print(gs.endOfLastMonth());
gs.print (gs.endOfLastWeek());
Returns the
date and time for the end of last year in GMT.
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 7/15
11/24/22, 7:02 AM Glide System
gs.print (gs.endOfThisMonth());
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 8/15
11/24/22, 7:02 AM Glide System
gs.print (gs.endOfToday
());
37.
Working with endOfTomorrow
() method
var errorMsg =
gs.addErrorMessage ('Please fill mandatory fields');
gs.print
(gs.getErrorMessages (errorMsg));
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 9/15
11/24/22, 7:02 AM Glide System
gs.addInfoMessage ('User
initials: ' + userInitials);
gs.print (myMsg);
gs.print
(gs. getSessionID ());
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 10/15
11/24/22, 7:02 AM Glide System
48. Working
with isFirstDayOfMonth ()
method
This method will checks whether the
date is the first day of the month.
49. Working
with isFirstDayOfWeek ()
method
Checks whether the date is the first day of the week. This uses the ISO
standard
of Monday being the first day of the week.
50. Working
with isFirstDayOfYear ()
method
Checks whether the date is the first day of the year.
gs.print (gs.isFirstDayOfYear(2020-04-12));
51. Working
with isLastDayofMonth () method
Checks whether the date is
the last day of the month.
gs.print (gs.isLastDayOfMonth(2020-04-19));
52. Working
with isLastDayofWeek () method
Checks whether the date is
the last day of the week.
53. Working
with isLastDayofYear () method
Checks whether the date is
the last day of the year.
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 11/15
11/24/22, 7:02 AM Glide System
54. Working
with lastWeek () method
Returns the date and time
one week ago in GMT.
55. Working
with now () method
Returns the current date
in UTC.
56. Working
with nowDateTime () method
Gets the current date and
time in the user-defined format.
57. Working
with nowDateTime () method
Returns the current date
and time in UTC format.
58. Working
with setProperty () method
Sets the specified key to
the specified value.
gs.setProperty("glide.foo","bar","foo");
gs.info (gs.getProperty("glide.foo"));
59. Working
with setRedirect () method
Sets the redirect URI for this transaction, which then
determines the next
page the user will see.
gs.setRedirect("com.glideapp.servicecatalog_cat_item_view.do?
sysparm_id=d41ce5bac611227a0167f4bf8109bf70&sysparm_user="
+
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 12/15
11/24/22, 7:02 AM Glide System
Share
Labels:
Glide System
COMMENTS
Enter Comment
POPULAR POSTS
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 13/15
11/24/22, 7:02 AM Glide System
UI PAGES
Share
4 comments
Powered by Blogger
ServiceNow Buddies
VISIT PROFILE
Archive
Labels
Report Abuse
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 14/15
11/24/22, 7:02 AM Glide System
https://servicenowbuddies.blogspot.com/2022/10/glide-system.html 15/15