7.1: UI Policies and Business Rules Flashcards

1
Q

Scripting Areas in ServiceNow
ServiceNow has over 30 places where code can be inserted to change the behavior of the platform.

A
  • Data Policies
  • UI Policy and UI Policy Actions
  • UI Actions ———-
    Business Rules ———-
    Client Scripts ———-
    ACL Scripts ———-
    SCRIPTING ———-
    UI Macros
    UI Scripts
    UI Properties
    UI Pages ———-
    Flow Scripts ———-
    Transform Maps ———-
    Script Includes ———-
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JavaScript is used almost everywhere, and it is a very flexible and powerful language commonly known for its inclusion in most modern web browsers.

A

This has made it almost mandatory for web development these days, with its simple syntax allowing many people to quickly add simple logic to web pages with minimum effort. Taking advantage of this familiarity, ServiceNow uses JavaScript both on the server and on the client. In this module, we will cover the highlighted concepts. 346

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

Sample Policies, Actions, Rules, and Scripts

A

*UI Policy can make fields read-only, mandatory, or hidden
*UI Action can make Save button visible on form for appropriate users
*Data Policy can enforce mandatory data on form
*Data Policy can enforce mandatory data on import
*Business Rule can trigger confirmation email to caller when Incident is first submitted.
*Client Script can prompt that an Incident has been successfully submitted

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

What is Scripting in ServiceNow?

A

Scripting in ServiceNow or Platform Scripting is the customization of an instance and/or applications using JavaScript.
JavaScript may execute on the client side (web browser) or the server side (ServiceNow database) and can fundamentally alter the baseline instance and user experience.

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

Client / Server

A

Client refers to an application or system that accesses a remote service or another computer system, known as a server. A server is the computer program running as a service; a physical computer dedicated to running one or more services, or a system running a database.

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

ServiceNow uses an Application Platform as a Service ( aPaaS) model

A

the web browser is the client. The web browser is the only thing that is installed on the client. The application server and the database live at the Data Center. Client scripts run on t he client browser. Server scripts run on the server (which includes the database).
Client-to-server round-trips take time and make the end-user wait for the round-t rip to complete. Request + Response = Round t rip

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

UI Policy and UI Policy Actions

A

*A User Interface (UI) Policy is a rule that is applied to a form to dynamically change information or the form itself.
*UI Policies execute on the client side.
*Use a UI Policy to set fields on a form to:
* Mandatory or Optional
* Hidden or Visible
* Read-only or Editable
*To apply a UI Policy to all views, set the Global setting to true.
*Once a UI Policy is saved, UI Policy Actions determine what happens on the form, including:
* Setting a field as mandatory – requiring a value in order to save the record
* Setting a field as hidden – no longer displaying a field on the form
* Setting a field as read-only – preventing a user from updating its value
*UI Policies are not about security, they are about managing the user experience and data integrity.

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

To immediately implement updates and changes to form s and lists, you can use UI Policies which allow you to

A

add sophisticated controls without having to write scripts and define custom process flows for tasks. 349

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

Data Policies
Internet <->Application Server <->
ServiceNow Database

A

are similar to UI policies, but UI Policies only apply to data entered on a form through a standard browser. Since UI Policies can also manage the visibility of fields on a form, you may want to augment UI Policies with Data Policies.

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

A Data Policy is

A

a rule that enforces data consistency by setting fields as mandatory and/or read-only.
Internet
Application Server
ServiceNow Database
Data Policy controls are similar to UI Policies, but UI Policies are only enforced on data entered into a form (passing through the UI).
Data Policies are similar to UI policies, but UI Policies only apply to data entered on a form through a standard browser. Since UI Policies can also manage the visibility of fields on a form, you may want to augment UI Policies with Data Policies.
Data Policies are applied to all data entered into the platform: form (UI), Import Sets, or Web Serv ices.
A Data Policy executes on the server side but can also run as a UI Policy on the client side.

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

A Data Policy enforces
(Presadzujú sa zásady údajov)

A

requirements on field and record data when the data is inserted into ServiceNow or when the data in an Import Set is submitted through an external system. Data Policies can be opted out for Web Services and Import Sets. A Data Policy is used to set mandatory and read-only states on form fields. Data Policies can be used on lists to make a field read-only; the field will appear to be editable, but the update will fail.
*The purpose of a Data Policy is to standardize the same data across ServiceNow applications.
*NOTE: Data Policies are not about security, they are about managing the integrity of the information stored in the database. Defining a Data Policy enforces the policy when a record is submitted from the UI. This behavior cannot be changed. 350

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

User Interface (UI) Actions

A

add buttons, links, and context menu items on forms and lists, making the UI more interactive, customizable, and specific to user activities.
The New button on the existing list of All Incidents is an example of a UI Action.

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

UI Actions can contain scripts that define custom functionality.

A

UI Actions can be server or client side depending on the ‘client ‘ check box selection. This setting determines when a UI Action can appear.

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

UI Act ions include:

A
  • Form buttons
  • Form context menu items (right-click the header)
  • Form links (Related Links in a form) * List buttons
  • List context menu items (right-click a record)
  • List choices (at the bottom of a list)
  • List links (Related Links at the bottom of a list)
    NOTE: When the UI Actions Active box is checked, the UI Action is visible and can be interacted with by a user. 351
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Client scripts

A

make “real-time” changes to the appearance of the user interface, especially forms.
Client Scripts can be created to do the following:
✓ Automatically update the location field to reflect the value
(user) entered into the caller field
✓ Disable the attachment link of a closed record when the form is loaded so a user is unable to add or modify attachments
✓ Display a notice at the top of the page to confirm a catalog request was submitted

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

Client Script s allow for browser/form

A

manipulation and verification such as making fields visible on a condition. An example of this would be an alert appearing when a user changes the priority of an incident . Client Scripts get executed on the browser, but you may also run a Client Script when a database lookup is needed; if you think you need database info, and you need the info frequently (such as every form load) then ask: Is it a field you can add to the form but hide? Is it something you really, truly need?

17
Q

Several types of scripts are supported:

A
  • onCell Edit(): runs when a cell on a list changes value through use of the list editor
  • onChange(): runs when a particular field changes value
  • onLoad(): runs when a form is loaded
  • onSubmit(): runs when a form is submitted
18
Q
A

Unlike onLoad() or onSubmit () scripts, onChange() scripts apply to a particular field on a form , rather than to the form itself. They are fired when a particular field on the form changes. An onLoad() script runs when a form is first drawn and before control is given to the user to begin typing.
Typically, you use an onLoad() script to perform some client-side manipulation of the document on screen. An onSubm it () script runs when a form is submitted. Typically, you use an onSubm it () script to validate things on the form t o make sure the submission makes sense. As such, onSubm it () script s can potentially cancel a submission by returning false. 352

19
Q

Catalog Client Script Example

A

*Client Scripts
Control the behavior of catalog items when presented to users
*Tips from the Field
If no-code alternatives can achieve the same goal, use them instead!

20
Q

When to Run

A

OnLoad - modify choice list options available
OnChange - on change of variable A, clear value of variable B
- on change of variable A, populate values of variables B and C
OnSubmit - validate field values
* start date < end date
* justification > X characters long 353

21
Q

Catalog client scripts run

A

client-side to control behavior of items presented to users. Use catalog client scripts to validate content, populate fields dynamically, or clear variable values based on changes to other variables. 353

22
Q

Script Types: Business Rule

A

A Business Rule is configured to run when a record is displayed, inserted, updated, deleted, or when a table is queried.
Business Rules execute on the server side 354

23
Q
A

Business Rules can be set to run before or after the database action has occurred.
The When setting determines when the Business Rule executes and has the following choices:
* Before a record is saved to the database
* After a record is saved to the database
* Async (queued); client and server work independently so the client is not waiting for the server
* Display before the record is displayed.
Business Rules execute on the server side 354

24
Q

Although there are multiple ways to control behaviors in the ServiceNow application, most customization of platform behavior is done using Business Rules. Business Rules are

A

loaded and initialized at the beginning of each interaction between a user and the platform. Every business rule is assigned either to an application scope (use scoped APIs when scripting in a scoped application) or to the global environment (application scope that identifies applications developed prior to application scoping, or applications intended to be accessible to all other global applications). 354

25
Q

Every Business Rule includes what

A

table to run against and timing (before or after insert and more), what conditions to evaluate, and what script to run based on the evaluation. 354

26
Q

Business Rules are consistently applied to

A

records regardless of how they are accessed; through forms, lists, or web services. The application of business rules through forms, lists, or web services and client scripts when fields are modified on a form is the primary difference between Business Rules and Client Scripts. 354

27
Q

Unlike UI Policies, Business Rules are NOT real -time:

A
  • They do not monitor fields on a form
  • They monitor records as they are inserted or updated ,354
28
Q

The primary objective of display Business Rules is to

A

use a shared scratchpad object,
“g_scrat chpad”, which is also sent to the client as part of the form . This is useful when you need to build client scripts that require server data that is not part of the record being displayed.

NOTE: Before scripting a business rule, consider whet her you can accomplish the same goal in Flow Designer. 354