SN Application Developer Fundamentals Flashcards

(229 cards)

1
Q

When should you script?

A

When you’re adding a whole new functionality; building an application suite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you open a table’s form view from the application navigator?

A

<table_name>.form
</table_name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens when you type <table_name>.CONFIG in the Application Navigator</table_name>

A

A new tab is opened with the configuration view for the table to display changes to that table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do you need to do to get var and const to both work?

A

Use ECMAScript 2021 (ES12) mode. If turned off, const does not work. Turn on using toggle switch in the script form

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name two client Glide types that are designed for ServiceNow

A

g_form and g_user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

For client scripts, what three types are there for UI Type

A

Desktop, Mobile/ServicePortal or All

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Should you use Client Side entities for Security?

A

No. Easily hacked. Can be seen within the browser itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the four trigger types on client scripts

A

onLoad, onSubmit, onChange, onCellEdit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the onCellEdit trigger type used for in Client Scripts

A

It is used when a particular field value in a list changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you tell if an object is for client side or server side?

A

Client is g_xxx, Server side is gs_xxx or gr_xxx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name five application characteristics that make for an app that is a fit for ServiceNow

A
  1. Can be modeled relational database
  2. Needs workflow/flow to manage processes
  3. Extensive use of forms
  4. Can extend existing functionality thru JavaScript
  5. Requires reporting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What type of applications does SN specialize in?

A

Business to Employee (B2E)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does least privilege mean in the context of an app

A

It only has access to what it needs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the advantages of scoped application

A
  1. Protected from other applications
  2. Protects other applications
  3. App only has access to what it needs
  4. Have to config the app to allow other apps to access it and its data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What release did application scopes become a feature

A

Fuju (2014)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What release was the first to include Studio

A

Geneva (2015)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Can an applications scope be changed once the record is saved in the db?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Is it a best practice to work in a private scope?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the baseline, what type of access do applications outside of the current scope have?

A

Read access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What type of apps can be controlled thru Delegated Development?

A

Scoped applications. Global applications cannot take advantage of Delegated Development

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What three parts make up an applications namespace

A
  1. Prefix = x_
  2. The company name - 2-5 characters stored in glide.appcreator.company.code system property
  3. application ID - Can be up to 40 characters but the system truncates the name to 18 characters for the namespace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Where do admins manage Delegated Developers and the content they can access?

A

Studio. Access can be granted to only Scoped applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What developer permissions are needed to create advanced business rules

A

All Files and Allow Scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How does an admin set developer permissions per application

A

Navigate to File->Manage Developers in Studio

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What manages and stores changes (version) to an application and produces a file for export
Update set
26
What is used for installing and updating applications on all company instances
Application repository
27
What should you avoid when moving update sets between releases
Moving update sets from a new release to an older release
28
What property must be the same for an application repository
glide.appcreator.company.code
29
What is done to move an application to the App Repository
Publish
30
What is the Scope development process
Analyze, Design, Develop, Test, Deploy (ADDTDP
31
What are the three modes of the JavaScript engine
Compatibility mode, ES5 Standard Mode, ECMAScript 2021 (ES12)
32
What JavaScript mode is used in global scripts?
Compatibility mode
33
What does a developer need to do to build and distribute applications in the SN Store
Join the SN partner program
34
What the SN do with apps that the developer wants to distribute to the Store
They certify the applications for compliance and best practices
35
Where can a developer find a success pack which provides tools to help plan and design projects such as designing and developing a new application.
Now Create
36
What are the eight different sections of the Application Development Checklist
1. Define Process 2. Design Build Data Model 3. Design and Create User Interface 4. Apply Security 5. Automate 6. Integrate 7. Enhance User Interface 8. Test
37
What are the six considerations for the Define Process Section of the Application Development Checklist
1. Business Problem 2. Outcomes 3. Inputs 4. Outputs 5. User personas/stakeholders 6. Process Steps
38
What should you do when you see the "This record is in the application, but is the current application. To edit record, click here."
Do not click here. Change the scope in the Application picker and the Update Set Picker (the globe)
39
Which objects potentially change GUI aspects like make a data field blink or have color or adjust data before the record is saved?
GlideList and GlideForm
40
Which object is cleaner: GlideRecord or GlideQuery
GlideQueary
41
When are Client Scripts loaded
Loaded with the form
42
The messages field is used for internationalizing. What has to occur to get a localized language?
if an entry exists in the sys_ui_message table with the same key but a localized language
43
When do UI policies run?
After Client Scripts
44
What is the preferred mechanism to use: Client Scripts or UI policies
UI Policies
45
What does a UI policy do?
Changes fields on a form based on a set of conditions.
46
Name six JavaScript classes that execute on the Client side
1. GlideForm 2. GlideUser 3. GlideRecord 4. GlideList 5. GlideAjax 6. spModal
47
Name eight classes and methods that execute on the Server side
1. GlideRecord 2. GlideQueary 3. GlideSystem 4. GlideElement 5. GlideAggregate 6. GlideDateTime 7. JSON 8. Workflow
48
What should be used first if it will do what is needed to configure the instance
Use the Condition Builder
49
What are the main components of a client script
1. Name 2. Table 3. UI Type 4. Type of script 5. Script 6. Messages - Used for internationalization
49
Name seven things performed by Client Scripts
1. Making a field mandatory 2. Set one field in response to another field 3. Modify choice list options 4. Show/hide sections of a form 5. Display an alert 6. Hide fields 7. Prohibit list editing
50
For a client script, if Global is not selected, what must be specified
The view to be used
51
What determines precedence when multiple client scripts exist for the same table and have conflicting logic
The order field is used. Executes from lowest to highest. Does not show in the baseline. Must modify the Client Scripts form to get 'order' to show
52
Can users modify a form field while a client script is executing?
No
53
For a client script, when does onLoad execute
When a form loads and before control is given to the user. Typically used to manipulate a form's appearance or content on the screen
54
For a client script, when does onSubmit execute
When a form is saved, submitted, or updated. Typically used for form validation
55
What happens after a form is saved and the onSubmit executed
Since the form will reload after a save, onLoad would execute
56
If there is something wrong with the form that should prevent the record from being created or updated, would should onSubmit do?
Return false;
57
For a client script, what does onChange execute
When a particular field changes.
58
When is onChange typically run
To respond to field values of interest and when modifying one field in response to another
59
What is added to the form for an onChange client script
The field of interest
60
What parameters must be specified for the onChange client script
control (the field that has changed), oldValue, newValue, isLoading, isTemplate
61
What does isLoading mean for Client Scripts
A boolean indicating whether a change is occurring as part of a form load. Thus all fields are changing. True means it is a form load.
62
What does isTemplate mean for a client script
The change is due to the population of a field by a template
63
What does === mean in a JavaScript
The value and the type must match to meet the comparison
64
Does the onCellEdit Client Script type apply to List Widgets and Dashboards on a user's homepage?
No
65
What is specific to the onCellEdit Client Script types
A callbackfunction boolean is returned. A true, makes the change and other related scripts are executed. If false, no other scripts are executed and the change is not committed.
66
What is a catalog Client Script
A client script that applies to a Catalog Item or a Catalog variable set. The catalog item and the field name are included in the onChange Catalog Item Client Script type. The types are onLoad, onChange and onSubmit.
67
What is GlideScratchpad (g_scratchpad) used for
Client side API that is used with a Display Business Rule Server Side Script. Can be passed to a UI Policy
68
what is g_user?
an object whose properties contain session information from the currently logged in user and their roles
69
What are the object properties of g_form?
The fields from the currently loaded record
70
What methods does g_form have
1. addInfoMessage - display an info message at the top of the form 2. addOption - adds an option to the end of a Choice list 3. clearMessage - removes messages previously added to the form 4. clearOptions - removes all options from a Choice list 5. clearValue - clears a field's value 6. flash - flashes a field's label to draw attention to it 7. getSection - returns a sections elements in an array 8. getValue - returns a fields value 9. isNewRecord - returns true if a record has never been saved 10. setValue - sets a field's value 11. showFieldMessage - displays a message under a form field
71
Does g_form methods refer to fields by their field name or their label
Field name
72
What is GlideForm?
A class
73
Where does g_form.getValue() get the data from?
The form. NOT the database. A string containing the field name is passed. NOTE: g_form always returns a string. If an integer or number is needed use g_form.getIntValue or g_form.getDecimalValue
74
What does g_form.getValue return if the field is a choice list
It returns that value, not the user friendly label. For example for impact it will return the string "1" or "2" or "3"
75
What does g_form.getValue return if the field is a reference field
The fields sys_id
76
Distinguish GlideUser and g_user
GlideUser is an API and class. g_user is a global object
77
what two entities are associated with g_user
Properties (firstName, lastName, userID, username) and methods (getClientData, getFullName, hasRole, hasRoleExactly, hasRoleFromList, hasRoles
78
Should you use g_user to apply Security
No. It can be easily defeated using developer tools built into browsers
79
Name two built-in client side debugging tools that
Script debug messages, Response Time Indicator
80
Name two JavaScript debugging tools
Alert, try/catch
81
Name three Script debug messages methods
g_form.AddInfoMessage() and g_form.addErrorMessage() and g_form.showFieldMessage()
82
Which is the name of the object to use when employing try/catch for the error information
err
83
What is the throw() function
Used to throw your own error messages for the catch function. You can catch user errors such as entering an invalid date value in a field.
84
Are reference Object data loaded into forms
No
85
Reference objects fields exist on forms but the Reference Object record itself is not loaded into the form: True or false
True
86
What do forms store for reference fields
The sys_id
87
What do forms display for reference fields
The records display value
88
How are Reference Object fields retrieved?
Thru a trip to the server and back
89
Can Reference Object fields be directly referenced from a Client Script?
No
90
What is a UI Policy
It defines the behaviors and visibility of fields on a form. Mandatory, Visible, Read-only.
91
When does a UI Policy execute
After Client Scripts
92
What happens if a UI Policy does not have a condition
It runs every time a form loads and/or is changed
93
What are the components of a UI Policy?
Condition, in Advanced View, if Run Scripts is checked, then a Script for if condition evaluates to true and if the condition evaluates to false is displayed. There is an Action related list that can make fields Mandatory, Visible or Read-only. There is also an onLoad toggle. There is also a 'Reverse if false' toggle
94
What is reverse if false for a UI Policy
The effects of the condition when it is true are reversed when the condition is no longer true. Also the Execute if false script will execute if the UI Policy conditions evaluate to false.
95
Where do you name a UI Policy
Use the Short Description field
96
What is important to know about a field that has a UI Policy Action associated with it?
It needs to be present on the form
97
What does Global mean for UI Policies
It applies to all form views. If not global, then the View needs to be specified
98
When should you use Data Policies instead of UI Policies
UI Policies conditions are only evaluated when a user manually changes a field on a form. If the change is made by the system, it is not rechecked. Use Data Policies which are not scriptable to manage mandatory and read-only state of fields for records not changed on a form
99
Name another type of UI Policy
Catalog UI Policy - Applies to "A Catalog Item" or "Applies to a Variable Set:, then name the Catalog Item. Use Catalog Variables for the Condition Builder
100
What are the four options for what the condition applies to for a UI Catalog Policy
1. Applies to a Catalog View 2. Applies to a Catalog Task 3. Applies on a Requested Item 4. Applies on a target record
101
When should you use a Client Script vs a UI Policy
102
Should you use a lot of UI Policies
No. Avoid long page load times by limiting the UI Policies
103
When do Business Rules run and where
They run on the Server Side and when a record is displayed, inserted, updated or deleted. They respond to all record access regardless of whether it is from a form, a query or web services.
104
What components makeup a business rule
Name, table, condition, when to run (before, after, display, async), based on whether its an insert, update, query, or delete. There is a tab to set field values on the record and then a script tab with a separate condition. The action tab also has abort transaction and message toggles. The message toggle opens up a message field to display on the next time the screen is rendored. The business rule also has a role conditions to specify what roles are needed to execute the business rule. This is a way to effect security on tables and fields.
105
Do business rules require scripting?
No. Check the advanced box to bring up scripting tab
106
What happens when a before query business rule has access constraints?
The number of rows removed from security constraints message will not be displayed.
107
When does a Display business rule run?
After the database is read and before the form is presented to the user.
108
When does a g_scratchpad global object property/value pairs have data
When a Display Business Rules executes. This is the primary purpose of the Display Business Rule. To access the values from a Client Script, the Client Script reads the values from the g_scratchpad object. Note that the names of the property/value pairs is up to the developer
109
When does a before Business Rule run
It executes after form submission and before the record is updated in the database.
110
When does an after Business Rule run?
After form submission and after the database is written to
111
When do Async Business Rules run
After records are inserted, modified, queried. They run as Scheduled jobs. Good to use when the user does not require an immediate response. When Async is selected, a priority field is displayed. It allows the current transaction to finish without waiting on the Business Rule to finish
112
On a business rule advanced tab, what is in the condition
A javascript statement that is used as the condition. When to run and the condition on the Advanced tab both have values, they both must be true to execute the script.
113
What are the pre-defined server side global variables
current, previous, g_scratchpad
114
Regarding global variables, what does 'previous' represent?
An object that stores the records fields and values before any changes were made (ie. the original values when the form loaded)
115
What type of relationship is dot walking
One to one
116
In the Fields category in the Script Editor, what does a Blue circle mean
The field resides in the current table
117
In the Fields category in the Script Editor, what does a Red square mean
The field resides on a parent table
118
In the Fields category in the Script Editor, what does a an index icon mean
The field is part of one or more indexes
119
Which glide system objects send data to the system log
gs.info() gs.error() gs.warn() gs.debug() - When in debug mode or session debug for the application is enabled gs.log() - legacy; only used in the global scope. Use gs.info() instead
120
What glide system objects send data to the top of the form
gs.addInfoMessage() gs.addErrorMessage() gs.methodName() gs.info("The record was opened: " + current.opened_at); //An example
121
What is the Script debugger used for
Debugging Server Side scripts
122
How many Script Debuggers can a user have open at one time
One
123
When debugging, what scripts running asynchronously cannot be stepped into
Scheduled jobs Asynchronous Business Rules Workflow scripts Inbound e-mail scripts
124
What has to be open in order to debug scripts
The Script Debugger has to be open
125
In the Script Debugger, what do Log Points do?
They allow developers to inject logging into running services without restarting or interfering with the normal function of the service
126
What property allows for setting Log Points
glide.debug.log_point system property
127
While debugging, what allows the user to inspect request parameters of the currently paused transaction
Call Stack
128
When the debugger is paused, what can you do in the Console pane
Evaluate expressions. Define, declare, inspect new variables and functions
129
What can you see in the Script Debugger Coding pane header
The script type and the name of the script currently running
130
What type of variables can you see in the Script debugger
Local, Global, Closures(displays a list of global scope variable names and their values set ty function closers
131
What does Script Tracer do
Allows for filters to search thru all scripts being executed. The Script Tracer then searches for changes that occur during script execution. the Script Tracer tool provides a powerful way to trace and debug these scripts as they execute in real time, making it easier to identify issues and ensure your applications are functioning as expected. You can see changes to records and any errors that occurred.
132
What does the GlideSystem API allow for
Access level information 1. Logged in user 2. System 3. Date and Time
133
Name some GlideSystem user method
gs.getUser - reference to the user object gs.UserDisplayName - returns the name field of the current user (Fred Lundy) gs.getUserID - returns the sys_id of the current user gs.getUserName - returns the username of the current user (fred.lundy) gs.hasRole - true if the current user has that specific role gs.hasRoleInGroup
134
Which glide system method writes to the system log
gs.info() - writes a message of type info to the error log, gs.error() - writes a message of type error to the system log
135
What are some GlideSystem system methods
getProperty() - returns the value of a Glide Property getPreference() - gets a user preference getDisplayColumn() - gets the Display column for a table tableExists(). nil(), eventQueue() - queues an event for the Event Manager print() - writes a message to the system log log() - logs a message to the system log and saves it to the syslog table logError(), getMessage() - retrieves messages from a UI message
136
What is one advantage of using the gs.getMessage() method
It allows for localization
137
Can you call a global Glide API from a scoped application
No
138
What scoped APIs should be used to work with date/time fields
GlideDate or GlideDateTime
139
Where do GlideSystem API methods log(), warn(), error(), isDebugging() and error() write to?
System Logs -> System Log -> All
140
What two API types does GlideSystem reside in
Global and Scoped Applications
141
Can a dev call GlideRecord from the client side
Yes, but it should be avoided due to performance impact
142
What happens with the addQuery method when an invalid field name is specified
The condition will be ignored. You can add a glide.invalid_query.returns_no_rows system property with a value set to true to instead have invalid queries return no rows in the GlideRecord object
143
What operators can be used with the addQuery method
= != < > <= >= STARTSWITH ENDSWITH CONTAINS DOESNOTCONTAI
144
What is the syntax for a GlideRecord query
var = new GlideRecord(''); .addQuery('', 'operator', ''); //additional addQuery's are ANDed .query()
145
How does the dev process returned records from a query()
while (.next()) { script logic }
146
How does the dev update records that were read from the GlideRecord API
.update();
147
How does a developer make addQuery's have an OR condition
Two ways .addQuery('', 'operator', ').addOrCondition(, 'operator', 'field'); The script macro vargror can be used to create a template for the addOrCondition
148
What does the GlideRecord method get do
Returns one record from the DB and executes a .next() method
149
What should be used to confirm records were returned from a query()
use the var retRows = .getRowCount(); method
150
The getRowCount is a simple method to get the number of records for an object. It has a performance impact. What should be used instead?
var count = new GlideAggregate('); count.addQuery('', 'operator', ''); count.addAggregate(COUNT'); countQuery(); var incidents = 0; if (count.next()){ incidents = count.getAggregate('COUNT") };
151
What is added to an 'addEncodedQuery' method
Copying a filter used on a table using Copy Query from the breadcrumbs after a filter has been used for example from a table list that was filtered
152
What is inherited by the GlideRecord API and can be used to enforce ACL rules?
GlideRecordSecure
153
What does GlideRecordSecure do
Non writeable fields are set to NULL canCreate() on a column is replaced with canWrite()
154
What is GlideQuery
Server side API A global sript include Has GlideRecord in the background It fails fast, is JavaScript and is expressive It includes the addQuery and Query methods Get NiceErrors which can prevent destructive behaviors of GlideRecord
155
With GlideQuery, which type is for reading one record
Optional
156
With GlideQuery, which type is for reading in multiple records
Stream
157
Which GlideQuery method does the streaming
forEach(function(s)) { }
158
Which GlideQuery method is used for Optional
selectOne('object field1', 'object field2')
159
In a Script include record, what needs to be set in order to call the Script from the Server Side
Glide AJAX enabled
160
How is a script include's API named
scope.