Platform Scripting Flashcards
What are plugins?
Software components that provide additional optional features & functionality withing a ServiceNow instance
What is the recommendation before adding scripts in ServiceNow?
Check the list of available plugins
In which application can one look for available plugins?
System Definition > Plugins
How do we get a plugin that is only made available upon request?
By submitting a request using the Request Plugin Activation form at Now Support (HI)
What is Scripting in ServiceNow used for?
The customization of an instance and/or applications using JavaScript
What functionality is recommended to use for configurations instead of scripting?
Condition Builder
What are APIs?
Classes and methods that we can use in scripts to define and customize functionalities
What is an application or system that is used to access a remote server?
Web browser
How is a server defined?
A physical computer running one or more services, or a system running a database
Define Client-Side scripts in short
Scripts that run in the browser
Define Server side scripts in short
Scripts that run on the server (where the DB lives)
What is a round-trip?
Request + Response
Can we run a Client script when a database lookup is needed?
Yes
What are different types of supported Client scripts?
- onLoad()
- onChange()
- onSubmit()
- onCellEdit()
When does onLoad() run?
When a form is loaded and before a user can edit it.
When does onChange() run?
When the value of a field changes.
onChange() applies to fields rather than to forms
When does onSubmit() run?
When a form is
- saved
- submitted
- updated
- Used to validate that the values entered on a form make sense before saving
When does onCellEdit() run?
When a cell on a list changes value through use of the list editor
What can be used to implement updates and changes to forms and lists without having to write scripts?
UI policies
Define a UI policy.
A rule that is applied to a form or a list to dynamically change information or the form itself
What functionality determines what happens on the form once a UI policy is configured?
UI policy actions
Give examples of UI policy actions on a form
- Set a field as mandatory
- Set a field as hidden
- Set a field as read-only
Recall what a Data policy is used for in the platform
- Data policy enforces requirements on field and record data when the data is imported into ServiceNow
- Used to set mandatory and read-only states on form fields
What are the differences between Data policy and UI policy controls?
- UI policies are only enforced on data entered into a form or a list through the UI
- Data policies are applied to all data entered into the platform (UI, import sets, web services)
How to make a data policy run as a UI policy?
Set the data policy attribute Use as UI Policy on client to true (check the box)
What do UI actions do?
- UI actions add buttons, links, context menu items on forms and lists
- UI actions make the UI more interactive and customizable based on user activities
UI actions include…
- Form buttons
- Form context menu items (right-click form header)
- Form links (Related links in a form)
- List buttons
- List context menu items
- List choices (at the bottom of a list)
- List links (Related links at the bottom of a list)
How do we make a UI action visible so that a user can interact with it?
Check the UI Action Active checkbox
How do we make a UI action display before another UI action in the User Interface?
By setting its Order attribute (100 displays before 200 and after 10)
Where can UI actions execute?
UI Actions can execute client-side and/or server-side
How to make a UI Action execute client-side?
By checking the UI Action Client attribute
Can UI Actions be scripted to define complex functionality?
Yes
Where do we navigate to show the Save, Insert, and Insert and Stay buttons on forms?
All > System Properties > UI Properties > “Show Save, Insert, Insert and Stay buttons on forms”
What is a business rule?
A business rule is a server-side script that runs when a record is
- inserted
- displayed
- updated
- deleted
or when a table a queried
When can business rules be set to run relative to database action?
Business rules can be set to run before or after a database action has occurred.
- Go to When to run in the BR form and choose Before or After
When are business rules loaded and initialized?
Business Rules are loaded and initialized at the beginning of each interaction between the user and the platform
How are business rules assigned regarding scope?
Every business rule is assigned either to an application scope or to the global environment
Which attribute must we select as true in the Business Rule form so that we can configure the When and Order fields?
Select the Advanced attribute checkbox
What are the main components of a Business Rule?
- the table the BR runs against
- the timing: When to run tab (before / after / async / display) relative to an insert or update
- the Actions tab
- which conditions to evaluate
- the script to run based on the evaluation
What are the 4 choices for When to run a Business Rule?
- Before a record is saved to the DB
- After a record is saved to the DB
- Async (queued) for the client not to wait on the server
- Display before the record is displayed
What are the 2 fields in the Advanced tab of a Business Rule form?
- Condition field: to specify the JavaScript condition to run the script
- Script field: to write the script that runs when the condition is true
Are Business rules real-time?
- No.
- Business rules do not monitor fields on a form
- Business rules monitor records as they are inserted and updated
What is the primary objective of the Display Business Rule?
Use a shared scratchpad object “g_scratchpad” which is sent to the client as part of the form.
Useful when need to build client scripts that require server data that is not part of the record being displayed
What are the first steps when creating a UI Policy?
Identify the condition(s) under which the UI policy should be applied
Where to navigate to create a UI Policy on the incident table?
All > Incident > Open an incident > List context menu > Configure > UI Policies > New
All > System UI > UI Policies > Select [incident] table