SNOWYCODE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
ServiceNow CAD Exam Study Guide
Exam Study Guides

ServiceNow CAD Exam Study Guide

ServiceNow CAD Exam Study Guide

In this post you'll find resources for studying for the ServiceNow Certified Application Developer Exam (CIS-CAD).

This post contains everything I used to help me pass the exam. Similar to our other study guides, these resources are broken down by relevant links, links to study resources I used, and my notes from the learning course.

You can also check out our exam guides for ITSM Implementation and Software Asset Management (SAM) and Application Portfolio Management (APM).

If you're new to ServiceNow certifications, learn how to get certified in ServiceNow.

Structure of the Study Guide: 

  1. Relevant links -easily access the course, blueprint, and Webassessor
  2. Tables and roles - all tables and roles mentioned throughout the course listed
  3. Practice resources -links to resources I used to study for the exam
  4. Notes - a full list of notes from studying the content

Relevant Links

Practice Resources

Notes

*This section is broken down by module of the Now Learning CAD Course. The order is listed below:

I. Application Development Overview

II. Application Analysis and Design

III. Application and Modules

IV. Work with Application Forms

V. Control Access

VI. Automate Work

VII. Import and Integrate External Data

VIII. Test with ATF

IX. Application Development Topics for Further Study

I. Application Development Overview

A. Application Development Concepts

Why Develop a Custom Application?
  • To replace outdated, inadequate, custom business applications and processes
  • To extend service delivery and management all enterprise departments
  • To extend the value of ServiceNow
  • To bring greater levels of automation and consolidation to enterprise services and their management.
  • Assess needs of the organization before deciding on if you should build the application or not
Target the Right Applications
Processes Managed in Spreadsheets and Email
  • Spreadsheets
  • Macros
Department apps built on aging incumbent platforms
  • IBM/Lotus Notes
  • Clarify
  • Microsoft Sharepoint
Applications with a 'request-fulfill' pattern
  • Facilities management
  • Shift turnover
  • Reservations
ServiceNow's platform is specialized for building B2E applications
  • Applications are extended through industry-standard JavaScript
  • Enterprise grade cloud infrastructure
  • Runs within a browser: desktop, tablet, or smartphone 
Examples of Custom Applications
  • Pig Lifecycle Management
  • Time Card Management
  • Gift Card Management
  • Contract Management
  • Invoice Management
  • Truck Maintenance
  • IP Address Management
  • Document Workflow
  • Customer Feedback Management

B. Scoped Application Model

Philosophy of Scoped Apps
  •  Before designing and developing new applications, these guiding principles should be examined /applied
  • Scope protects an application from damage to or from another application. An application must be configured to allow out-of-scope applications to act on its records.
History of Application Scopes
  • Application scopes were introduced around the Fuji release (2014)
  • Scoped applications allowed for discrete, modular development, with less impact on the overall aspects of the platform.
  • With this in mind, some apps like HR and CSM were written (or re-written) as scoped applications.
  • With Geneva release, the integrated development environment, Studio, was incorporated to manage both scopes and general application development.
  • Scoped applications are sandboxed into their own application namespace which heavily restricts their ability to cause any performance issues to other running applications. They are also more secure in terms of who can access them.
  • It is best practice to work in a private scoped application. Artifacts are all of the application files comprising an application - these exist within the application's scope
Include but are not limited to:
  • Access Controls
  • Business Rules
  • Script Includes
  • Tables
  • Client Scripts

In the baseline case, custom apps have read access to each other's table records but cannot perform any other database operations

  • In general, new apps created by ServiceNow will be scoped applications. 
  • The scope name can be, at most, EIGHTEEN TOTAL characters long
  • The scope name must include x_, the two-to-five character app creator code property, and the subsequent underscore
  • In general, new functionality should be built within an application scope.
  • Common exceptions that require building in global include:

Modifications to legacy customization done in global

  • Support for applications built before scoping or deployed to production in global
  • Changes to base instance code that exists in global
  • Access required to global application files not available to scoped applications
  • Customizations with extensive dependencies in global where replication of global elements would introduce an excessive maintenance burden

C. Application Development vs. Application Deployment

Application Repository
  • Used for installing and updating applications on all company instances
  • To use application repository, an instance must have a valid subscription, matching application scope, and network access. As a result, PDI's cannot connect to the application repository
What is an Update Set?
  • Container for capturing customizations
  • Used to move customizations between instances
  • Allow you to apply changes in bulk, and help you force an instance to load the file versions you need
  • Essential for: Customizing baseline applications, Customizing applications purchased from the store
  • Useful for: Keeping track of why a change was made, Exporting work in progress ahead of a clone, Associating changes with SDLC artifacts, Stories, problems, bugs, enhancements, etc, Deploying an application if the app repo is unavailable
  • Use update sets down your instance chain to deploy code and configuration changes and clone back the instances once you have done that to match the environment 
  • Loading an update set created on a newer family release on an instance running an older family release requires additional testing to determine compatibility
  • Updates from newer family releases may not produce the same functionality when moved to older family releases.
  • Where possible, avoid moving updates from newer family releases to older family releases. Similar contraints apply to moving updates between instance running different versions of ServiceNow store apps
What is the ServiceNow App Repository?
  • A place for a company to share applications ready for distribution between its instances
  • Glide.appcreator.company.code value must be the same on all instances (maint only property)
  • Standardizes apps and app versions installed on instances
  • Easily install/uninstall/update apps
  • Admin role required
  • Central repository for all scoped apps that are published
  • Allows customers to upload and distribute applications between their instances
  • When you access the application repository, you can see and manage only the applications that are published by your own organization. You can't see or manage applications that are published by other organizations

In a full stack development environment, you use a completely different method and process

  • The master or main branch of your code represents a version of the application that is deployed to a prod environment
  • Continuous Integration and Continuous Delivery allows you to develop apps at scale with source control and continuous integration and continuous delivery toolsets on the Now Platform
What is CI/CD?
  • CI is a modern software development practice in which incremental code changes are made frequently and reliably.
  • Automated build-and-test steps triggered by CI ensure that code changes being merged into the repo are available. The code is then delivered quickly and seamlessly as part of the CD process.
  • In the software world, the CI/CD pipeline refers to the automation that enables incremental code changes from developers' desktops to be delivered quickly and reliably to production

II. Application Analysis and Design

A. Business Logic and User Interface

Before creating any application, take the time to plan a strategy. The design may change during application development, but it is most efficient to start with a well-defined plan.

If you are not solving a business problem, you do not need an application.

Personas largely equate to roles in ServiceNow. Generally speaking, security is applied to applications and their records using roles. It is recommended that every application have at least a User and an Admin role.

Inputs can take many forms such as Users, spreadsheets, and web services. Outputs can also take many forms such as dashboards, reports, and emails.

There are many strategies for defining a process, such as SIPOC (Six Sigma), ASME Standard for Process Charts, and others. Choose a strategy that works well for you. The more detailed understanding you have of a process, the easier it is to create an application.

  • If possible, create a flowchart for each process as this will be useful when it is time to create workflows.

You can create a record producer for tables and database views that in the same scope as the record producer. You can also do this for tables that allow create access from applications in other scopes

  • Role required: catalog_admin or admin

B. Build a Scoped Architecture Data Model - Database Logic

  • Each ServiceNow instance has its own database and is used to store data in tables comprised of various columns
  • While each application has their specific set of tables and columns, there are some tables like user, cmdb_ci, and task shared by many different applications
  • The database design underpins the entire application, so take the time to analyze your data needs and create a diagram
  • Client-side scripts should be kept to a minimum (thin)
  • Code should be maintainable, reusable, and efficient.
  • It is best practice to make and use a single reusable client-side library that is loaded and available to the form.
  • The Script Include library provides a single location for reusable functions. As a result, maintenance and time-to-completion reduce
  • A Scoped UI Script Library runs on-demand. On the client-side, use the ScriptLoader function to laod a Scoped UI Script library. On the server-side, convert gs.log messages to gs.info, gs,warn, or gs,error as appropriate

For each application, admins can

  • Grant non-admin users the ability to develop scoped apps
  • Specify which application file types the developer can access
  • Grant the developer access to security records
  • Grant the developer access to script fields
  • Remove a user as a developer

Developer permissions are application-specific

  • For example, a dev who has permission to access all file types for one application does not necessarily have any developer permissions for another application. Admins must set developer permissiosn for each application
  • In Studio, navigate to File > Manage Developers to set permissions for individual users and/or groups

Admins must be familiar with application files and the system table structure to set developer permissions

  • For example, a developer expected to create advanced business rules needs both the All File Types and Allow Scripting developer permissions
  • Application-specific deployment permissions allows an admin to assign a non-admin as a dev or deployment resource for an application. Admins can set which specific action the assigned user (non-admin) can perform
  • For example, the admin may enable a user to publish update sets, but prevent publishing to the application repository and the ServiceNow store
  • Instance-specific deployment user roles allows an admin to manually assign roles that enable non-admin users to install or upgrade all applications in specific instances

III. Application and Modules

A. Application Development Tools Overview

  • As you develop more custom applications, feel free to continue using AES.
  • Application Engine Studio (AES) is new and regularly updated with new features, so be sure to look at future family AES releases to learn what new features and capabilities are coming
  • ServiceNow Studio offers a simple way to create, review and update application files from a tabbed environment. The system opens Studio whenever you edit a custom application.
  • Guided Application Creator (GAC) guides users through the application creation process by stepping through the basic application contents

 Guided, low code tool for developing rich web applications to store information, automate business processes, and solve business problems.

  • By delegating development to business units in your organization, administrators are freed up to address more strategic, system-wide issues 

You can add several experiences to your application in App Engine Studio

Workspace
  • A suite of tools that provides agents, case managers, help desk professionals, and managers with tools to help answer customer questions and resolve customer problems.
  • App Engine Studio provides a basic workspace that includes a home page, lists, Analytics Center, and search
  • The workspace that you create in App Engine Studio includes several default pages. You can use these pages as-is or edit them to suit your business needs

The GAC is enabled via the com.glide.sn-guided-app-creator plugin by default on new and upgraded instances.

  • Users with the role sn_g_app_creator.app_creator have access
  • This feature is intended to be utilized by System Admins, Developers and Business Analysts

GAC has two access points:

  • System Applications > My Company Applications > Select New
  • In studio, select the create application button
  • The welcome screen will appear the first time GAC is used. To see the screen again, remove user preference sn_g_app_creator.has_viewed_gac

Integration Hub: Integration hub integrations are referred to as spokes, which are easy to configure and enable you to quickly add powerful actions without the need to write scripts

Table Builder: a tool for editing data tables that you've added to your application

UI Builder: a drag-and-drop, WYSIWYG editor for creating and editing Agent Workspace landing pages. To open UI Builder, use the Application Navigator to open Workspace Experience > Administration > All Workspaces

Flow Designer: enables process owners to automate work. Build multi-step flows from reusable components without having to code.

Creator Workflows: allow you to build connected digital workflow apps fast with a low-code platform

Process Automation Designer: allows you to build and manage multiple complex workflows easily with no-code playbooks and SN enterprise application development platform.

 Creator Workflows
  • Build connected digital workflow applications fast with a low-code platform. Empower citizen developers with prebuilt templates and low-code tools.
  • Enable reuse and speed delivery with modular building blocks created by pro developers.
  • Connect systems, applications, and data while providing visibility into end-to-end processes

B. Create a Custom Application (Tables and Data) Using Guided App Creator (GAC)

  • Application Configuration: Define the application Note: if the system property sn_g_app_Creator.allow_global is set to true, any developer or user with the sn_g_app_creator.allow_global role has the option to create a global app in GAC. If the property is false, only admins and users with the sn_g_app_creator.global role can create global apps.
  • User role: Assign existing roles, or create one or more roles for the new application. It is best practice to create at least one scoped role for the scoped application.
  • User Experience: Create one or more user experiences. UX format options include Mobile and Classic
  • Table: create one or more data tables via upload spreadsheet, extend a table, or create a table from scratch
  • Field inputs: continue defining the table with field inputs
  • Table configurations: define the table
  • Once the application's basic content is created, the user can add additional application artifacts via Studio or Flow Designer, or the user can set up another application
  • Once you have created an application record and defined roles in Guided Application Creator Creator, it is time to select user experiences.
  • You can choose up to two: Mobile, Classic
  • Working through the Guided Application creator, developers can choose to use existing tables or create custom tables for their application.
  • To select an existing table without creating a custom table:

In the tables field, enter the table name

  • On the list, select the table name
  • Select Done with Tables

To create a custom table without selecting an existing table:

  • Select create new table
  • Select a table creation method
  • Follow the steps for the table creation method that you selected

To select an existing table and create a custom table:

  • In the Tables field, enter the name of the existing table to designate for your application.
  • On the list, select the table name
  • Select create new table
  • Select a table creation method

Follow the steps for the table creation method that you selected

  • Upload a spreadsheet: Turn a spreadsheet into a custom table
  • Extend a table: Create a custom table that copies an existing table, and add additional fields to the child table
  • Create a table: if you create a custom table, review the Data table guidelines for Guided Application Creator in docs.servicenow.com to ensure you are within the limits of your subscription and that your application performs as expected
  • If you extend an existing table you inherit the functionality built into ServiceNow for the base table.
  • If you start from a "blank slate" (brand new table), you have the opportunity to script and configure the behavior of your application
  • Applications can use multiple tables:

Base table(s) that contain the primary application records

  • Reference/lookup tables

Tables must have the Extensible option selected in order to be extended. You cannot extend a system or database view table

  • The User Approval workflow activity works with all tables. All other Approval Activities work only with tables which extend task

C. Link Loaner Application to GitLab Repo

Source control integration supports all custom applications: global-scoped and private-scoped.

Follow these steps to link a SN application to Git:

  • Create a repository in the Git tool of your choice
  • Open the application of interest in studio
  • Open Source Control > Link to Source Control
  • Configure the link: repository URL, user name, and password
  • Select the Link to Source Control button

Use a MID server to link to a repository behind a firewall

Repository

Git Repository: A collection of files in a Git database

SN App Repository: A database containing ServiceNow apps

  • Commit: Sending local changes to Git
  • Stash: Storing local changes on your instance for later application
  • Merge: combining changes from different branches or local vs. remote changes
  • Branch: A copy of an apps files under the same account. Typically a version/release
  • Fork: a copy of a repository under a new account (includes branches)
  • Tag: A point in time marker. Once set, it cannot be modified. Can be used to create a branch in ServiceNow
  • Version: Git Version, ServiceNow Version
  • Publish: the process of sending the current local application the ServiceNow repository
  • Import: Bringing an existing app in a Git repository into Now Platform
  • Link: Connecting a local ServiceNow application to a new Git repository 

By default, the git repo has one branch names master considered the definitive branch.

In studio, once an application is linked to source control, a default branch is set. The default value is set to sn_instances/<instance_name> 

Creating a stash takes ALL local changes

  • You cannot pick and choose which changes to stash
Steps to create a stash:
  • In Studio, open Source Control > Stash Local Changes
  • Select the Stash Local Changes button
  • When prompted, select the Apply Stashed Changes button
  • Select the Close Dialog button
  • Most likely you will commit the local changes after creating a stash but it is not required
Steps to apply a stash to a branch:
  • Open Source Control > Switch Branch to switch to the target branch
  • Select the branch then select the Switch Branch button
  • Select the Close Dialog button
  • Open Source Control > Manage Stashes
  • Locate the stash to be applied and select the apply link
  • When the process is finished, select the Close dialog button
  • Open Source control > Commit Changes
  • Add a Commit Message and select the Commit Changes button
  • All changes are applied from a stash
The Action options are
  • Take Stashed Changes
  • Discard Stashed Changes

D. Configure Application Menu, Create Files, Commit Changes

  • With Global App File Management plugin, Studio allows you to add, remove, and move global application files
  • IF you are working with a globally scoped application, you can move existing , globally scoped metadata files between global applications. Files are searchable by the update set name, table or file name
To add files from the global scope to a global application:
  • Navigate to System Applications > My Company Applications > In Development
  • To the right of the application name, click Edit in Studio
  • Select File > Add Existing Files
  • Find existing globally scoped application files available for moving to the current globally scoped application
  • Select continue
  • Select the files that you want to add, and then select Add
To move an application file between global applications:
  • Navigate to the application file in a list or form view
  • Locate the Move to Application UI Action
  • Select the global application file you want to move
  • Select Move

It is not possible to change an application's scope. Legacy custom applications will always be part of the global scope. There is no migration path to a custom or different scope

To open an application for editing:
  • Open System applications > My company applications
  • Locate the application of interest and select the Edit in Studio button

An application can be opened in only one Studio window at a time. Multiple studios can be open at the same time, but each must contain a different application.

To view the existing business logic for a table:
  • Open the list for the table. Use a module to open the list or, if you know the table name, you can enter <table name>.list in the Application Navigator
  • Open the Additional Actions context menu (trigram) and select the Configure option
  • In the dialog, select the all button
To create a new table:
  • In studio, select the Create Application File button
  • Select Data Model > Table
  • Configure the new table
  • Select the Submit button

IV. Work with Application Forms

A. Field, Lists, Forms and Views - Concepts

  • Add fields to your table and not to the base table.
Steps to add a Field to a Table:
  • Open the application in studio for editing
  • Open the table record of interest
  • Scroll to the bottom of the Table Columns tab
  • Double click on "insert a new row"
  • Enter a Column label (field name)
  • Click the green check mark to save
  • Define the data Type by: Double clicking in the cell > Click the magnifying glass to bring up a list of field classes > Select the appropriate data type> Click the green checkmark to save> Configure other column parameters as required
Field Type Best Practices
  • Avoid the use of free-form text fields that allow users to enter anything unless you are sure that's what you want
  • Use string fields when consistent or specifically formatted data is not required: Don't use for dates, for fields that reference people by name or for reference objects
  • Use Choice Lists and Reference Fields to limit options
  • Only display fields for data you need
  • Choose the field type carefully as changed the type can result in data loss
To Add or Not to Add

Benefit from extending a table:

  • Strategy: use existing fields with no modifications

Can you retitle an existing field?

  • You need a text field called Scenario
  • Your table has an unsued field called Short Description
  • Strategy: re-label the short description field

Can you consolidate two fields into one?

  • You are asked for an acceptance date field and a rejection date field
  • Strategy: combine both into a single field called Decision

Configuring the label on a field changes the label only for the current table and not for the parent table(s).

Deleting Fields from a table

  • User-defined field can be deleted by selecting the red X button that appears to the left of the Column label
  • Inherited fields cannot be deleted
  • No table records are deleted when a field is deleted

New Fields and Forms

  • New fields are automatically added to the end of the form
  • New fields are NOT automatically added to lists.

To add fields to a list:

  • Open the list
  • Select the Personalized List gear
  • Select the columns to add
  • Arrange the Selected columns by clicking, holding and dragging the columns
  • Select the Save button
Form Design Considerations
  • Forms are the main way users interact with an application
  • Users must have a positive experience or they will be less likely to adopt an application
Ways to enhance user experience
  • Logical form layout
  • Logical groupings of fields in sections
  • Inclusion of appropriate fields
  • Meaningful labels
  • Keep labels short. Use hint, annotation, or help fields for longer descriptions
  • Tool tips to offer guidance
To change field's Label:
  1. In studio, open Forms & UI > Forms > form name
  2. Hover over the field of interest in the Form Designer
  3. Select the Settings (gear) button
  4. Enter a new value in the Label field
  5. Save
To specify a new field's hint
  1. Open the table's form
  2. Right-click on the new field and select Configure Label
  3. Enter the mouse over text in the Hint field
  4. Save
Provide Real-time feedback
  1. Immediate and targeted feedback to users (requires scripting):
  • g_form.showFieldMsg() : prints a message on a blue background below the field passed in the method call
  • g_form.addInfoMessage() : prints a message on a blue background to the top of the current form
  • g_form.addErrorMessage() : prints a message on a red background to the top of the current form
  • Alert() : a JavaScript method that opens a dialog with an OK button
  • Confirm() : a Javascript method that opens a dialog OK and cancel buttons
  • Feedback to users through message options
  • Effective use of color
To Stylize a field:
  1. In studio, create a new style
  2. Configure the Table and Field name
  3. If configuring a choice list for a particular value enter the value in the Value Field
  4. Enter the preferred CSS style commands in the Style field
  5. Select the Submit button
Helpful CSS formatting commands:
  1. Font-weight:bold;
  2. Text-decoration:underline;
  3. Font-style:italic;
  4. Text-align:center;
  5. Text-align:right;
  6. Font-size:18px;
  7. Background-color:blue;
  8. Color:yellow;
User views for selective data display
  • View is a saved version of a configured form or list. It defines which fields appear on the form or list and in which order.
  • Views enable users to quickly display the same form or list in multiple ways.
  • Admins can create any number of views for a form or list.
  • All Views have a Name and a Title.
  • Client Scripts and UI Policy scripts can execute selectively on Views
  • Users require the view_changer role to change views
Differentiation between mobile and desktop users
  • Keep the form as short as possible
  • Forms should be read from top to bottom
  • Important fields at the top
  • Reference number/name at the top
  • Place two-column layouts at the top of the form or section
  • Use full width, single-column layout for larger text fields
  • Use annotations and sections to break up long forms: Sections are logical groupings of fields
  • To create a form Section:
  1. In Studio, open Forms & UI > Forms >Form Name
  2. Create a new section by selecting the + button on an existing section
  3. Enter a name for the new Section and select the OK button
  4. Add fields to the new Section using the Field Navigator
  5. Select the save button
  • Tables only appear when there are two or more sections on a form. The default behavior of the platform is to display tabbed layout. To change this:
  1. Click on the user avatar in the instance banner
  2. Select preferences
  3. Click on the display tile
  4. Move the slider on the left to disable displaying form sections as tabs 

V. Control Access 

A. Configure Application Security 

  • If a user has access to the System Definition > Tables module, they can see all tables including those for which they cannot see records. Users can also type <table_name>.list into the Type filter text field in the Application navigator to attempt open the list of records for any tables
  • Depending on permissions:
  • They list may not display all records (number of rows removed from this list by Security constraints message)
  • The list page is not rendered (security constraints prevent access to request page message)
Application Menu Permissions
  • Follow these steps to set application menu permissions
  1. Open the application for editing in studio
  2. In the Application Explorer, select Navigation > Application Menus> <application menu of interest>
  3. Select the Edit roles button (pencil)
  4. Add the permitted roles to the Selected list from the Available list
  5. Select the Done button
  6. Save
Module Permissions

Control access to modules through roles:

  1. Users without the role cannot see the module
  2. Users with the role can see the module

Depending on ACL may not see records

To set module permissions:
  1. Open the application for editing in studio
  2. In the Application explorer, select Navigation > Modules> <module of interest>
  3. In the visibility section, select the Edit roles button (pencil) to the right of the Roles field
  4. Add the permitted roles to the Selected list from the Available list
  5. Select the done button
  6. Save 
Record and Field Permissions
  • Requires security_admin role and elevated security priviledges to edit
  • Access is denied by default
  • Four access controls can be created automatically when adding tables to an application 

If access is denied to a row, no field level rules can grant access
If access to a row is allowed but the field is denied, the field is not visible
If access to a row is allowed and access to a field is allowed, the field is visible 

Access Control Rules: Working with .None
  • The table.None read ACL gives read access to the records in the table to users with either asset or catalog roles 
Access Control Rules: Working with .field
  • The table.None read ACL gives read access to the records in the table to users with either asset or catalog roles
  • The table.u_field_3 read ACL gives access to u_field_3 to asset only
  • Read access to u_field_3 is denied to users with the catalog role because a field-specific ACL Excludes all other roles from read access to that field. However, all other fields are still visible.
Access Control Rules: Working with .*
  • The table.* read ACL for catalog gives read access to all fields for catalog that don't have a field-specific rule, and excludes users with all other roles. Therefore, asset can only see u_field_3, while catalog can see all other fields.
  • Table.* applies to every field on a record where there is no field-specific ACL 
Should you create a table.* ACL?
  • To easily exclude fields, use a .* ACL
  • To easily include fields, do not use a .* ACL

If a user fails a table access control rule, the user is denied access to all fields in the table, even if the user would pass a field ACL rule
If a user passes a table ACL rule, but fails a field ACL rule, the user cannot access the field described by the field ACL rule

An Object Hierarchy identifies the search:

  1. Explicit rule on self
  2. Explicit rule on field in parent
  3. …until parent doesn't contain field
  4. Wildcard rule on self
  5. Wildcard rule on field in parent
  6. …until parent doesn't contain field
Access Control Configuration

Allow access if all of the following are true:

  • The user has one of the Required roles
  • Condition field evaluates to true
  • Script field returns true or sets the variable answer to true
  • Other matching ACL rules for the object evaluate to true
  • Blank fields in Access Control equal true.
Access Control Scripting
  • Can use any server-side script logic
  • Very useful GlideRecord method: isNewRecord()
  • Useful GlideSystem user methods: hasRole(), getUserName(), getUserID()
  • *Access control script execute server-side. For best performance, avoid Access Control scripts that use GlideRecord queries as they can impact performance negatively 
Debugging Access Control - Field Level Debugging
  • Field level debugging and access ACL rule output messages are available to help troubleshot and debug
  • When debugging is enabled, a small bug icon appears beside each field with an ACL rule
Server-Side Scripting API - Security:
GlideSystem Methods
  • getUser()
  • getUserDisplayName()
  • getUserNameByUserID()
  • userID()
  • hasRole()
  • **Controlling access through GS is a better choice because it executes server-side**
GlideRecord Methods
  • canCreate()
  • canRead()
  • canWrite()
  • canDelete()

B. Set Application Access

Application Access
  • Set on a table-by-table basis

Runtime application protection against

  • Access by Scripts
  • Access through the Web Services API

The "Allow access to this table via web services" option is only selectable if the Accessible from option value is "All application scopes"

Accessible From Field:
  • Claims table Application Access
  • Unauthorized script access is prevented at runtime but does not cause runtime errors. Logic attempting unauthorized access is skipped
  • When Application Access is granted to All application scopes, the default configuration is to allow read access only
  • **Application access does not apply to scripts executed in the same scope
Allow Configuration:

Allows other application scopes to create artifacts for an application

  • Dictionary entry on a table
  • UI Action on the table
  • Client Script on the table

Business Rules, Access Control, and other metadata types can extend out of scope tables where Can read is selected.

Caller Access:
  • Restricted caller access records are used to track cross-scope applications that request access to an application, application resource, or event
  • Application restricted caller access is activated by the Scoped Application Restricted Caller Access plugin (com.glide.scope.access.restricted_caller)
  • The application admin or admin role is required to set access to an application
  • Caller Access Options:
  • --None--: Cross-scope calls to the resource are approved or denied based on the value of the Accessible from field
  • Caller Restriction: Calls to the resource must be manually approved. Access requests are tracked in the Restricted Caller Access table with a status of Requested
  • Caller Tracking: calls to the resource are automatically approved. Calls are tracked in the Restricted Caller Access table with a status of Allowed.
Protection Policies:
  • Protect intellectual property by making artifact logic read-only or not visible
  • Only applies when applications are installed from the ServiceNow App store
  • Does not prevent other developers on the application development instance from viewing or editing application artifacts.

Protection Policies can be applied to:

  • UI Actions
  • Script Includes

Protection policies are not applied when applications are published and migrated to an instance using an Update Set

The Protection Policy options are:

  • --None--: Logic is viewable and editable
  • Read-only: logic is viewable but not editable
  • Protected: logic is not viewable

VI. Automate Work

A. Flow Designer to Manage Deployment States

What is Flow Designer?
  • Intuitive interface for creating automated business processes

All flows consist of properties, a trigger, action(s), and the data collected or created. It also may contain conditions

  • Trigger: activity that initiates the flow. May be record-based or time-based. Flow designer creates an event entry each time a flow is triggered.
  • Application triggers: MetricBase and Service Catalog
  • Record Triggers: Created ,Updated or Created or Updated
  • Scheduled Triggers: Daily, Weekly, monthly, run once, and repeat
  • Condition: Statement to determine when or how an action runs
  • Action: Operation executed by the system. Actions can be reusable
  • Inputs: the values passed into the Action
  • Steps: Sequential units of application logic within the Action
  • Outputs: Data resulting from the finished Action, it can be used to pass data to actions in the same flow
  • Executions: List of executions associated with the flow. 
  • Data panel: any data gathered or generated as variables is available here. Each variable has its own pill that can be dragged and dropped on an action input or output 
When to use Flow Designer over Workflow:

Use Flow Designer if...

  • You are running on Kingston or newer
  • Your trigger is a CRUD table operation or schedule
  • All the steps/actions you need are in Flow Designer
  • Your logic includes if/then branching or a linear flow

**If you are modifying a base instance code already using Workflow, continue using workflow**

Integration Hub

Extends Flow Designer to provide low-code to no-code integration capabilities with 3rd party applications. It allows developers to encapsulate integration actions into reusable components that do not require coding to implement

Spokes:

  • Microsoft Teams
  • Microsoft AD
  • Microsoft Azure AD
  • Slack
  • HipChat
  • ServiceNow eBonding

Custom:

  • REST web service request step
  • Script step
What is a Spoke?
  • A spoke is a scoped application containing Flow Designer content for an application or record type
  • Bundled set of related actions

Spokes are activated when the parent application is activated.

There are multiple default spokes available such as:

  • Benchmarks spoke
  • Connect spoke
  • Customer service spoke
  • Field service spoke
  • ITSM spoke
  • Security operations spoke
  • Visual Task Board (VTB) Spoke

B. Create Application Properties

Application Properties:
  • Set application values from an application properties page
  • Single location for all application properties
  • Retrieve values and use in scripts
Process for Creating Application Properties:

1. Create a System Property Category

  1. In studio, select the Create Application File button
  2. Enter system property in the filter field
  3. Select System Property Category in the Filter Results pane and then select the Create button
  4. Name the category. No special characters, spaces are allowed
  5. Provide a title
  6. Save

2. Add Properties

  1. Scroll down to properties section on the System Property Category form
  2. Select the New button
  3. Configure the property: Select the Lookup using list button on the Property field > Select the new button > Configure the property > Submit
  4. Go back to System Property Category form
  5. Scroll down to the Properties section on the System Property Category form
  6. Select the Edit… button
  7. Locate the property in the Collection list and add it to the Properties list
  8. Save
Order Properties
  1. Double-click in the Order column for the property
  2. Enter the desired value in the Order Field
  3. Select the save button
Create Properties Module
  1. With the Application open in Studio, select the Create Application File button
  2. Type the text Module in the Filter… field
  3. Select the Module in the Filter Results pane and select the Create button
  4. Configure the properties module using the screenshot as a guide
  5. Configure the Read and Write roles to be the application's admin role
  6. Save
  7. Optional: Add a Separator module. The Arguments field contents appear on the separator line in the Application Navigator
  8. Syntax: system_properties_ui.do?sysparm_title=<property form header text>&sysparm_category=<name  of System Property Category>

C. Scheduled Script Execution and Email

Scheduled Script Execution
  • Automated piece of logic which executes at a specific time and/or on a recurring basis

Periodic Database Queries Examples

  • Overdue requests
  • All requests from a particular user
  • Records with a State value such as Resolved for too long

Periodic Record Modifications Examples

  • Set the State value to Closed Complete after a fixed time has elapsed
  • Assign unassigned records to a User
  • Delete all records created by a User

**Scheduled script executes are never triggered by actions taken by users or by modifications to records*** 

To Create a Scheduled Script Execution:
  1. In Studio, select the Create New Application File button
  2. Enter Scheduled in the filter field
  3. Select Scheduled Script Execution in the Filter Results pane then select the Create button
  4. Configure the Scheduled Script Execution
  5. Save
Run This Script
  • Executes Server-side
  • No current or previous object
  • Variables form the Condition Script are known to the Scheduled Script Execution Script 
Testing
  • Use the Execute Now button
  • Available only after a Scheduled Script Execution is saved
What is Running When?
  • Today: System Scheduler > Scheduled Jobs > Today's Scheduled Jobs
  • Everything on the schedule: System Scheduler > Scheduled Jobs > Scheduled Jobs
  • **Although edits can be made to the list, it is not advices. Let the scheduler control when Scheduled jobs run
What is an Event?
  • Indication that something notable has occurred
  • Entry in Event Queue. Logic must be written to respond to entries in the Event Queue and take action
  • Workflows, business rules, scripts go into the event queue, email notifications and script actions come out of the event queue
  • **Although any server-side script can generate an event, it is most commonly done in Business rules or workflow scripts
Working with Events
  1. Add Event to Event Registry: Event registry is a table of Events that can be called and responded to.
  2. Generate Event
  3. Create Logic to respond to Event

**Unless otherwise specified, all user-created events appear in the default queue***

Registering Events

ServiceNow can only respond to Events that are registered. Registration means that the ServiceNow processes are able to recognize and react to Events

To register an event: In studio, create a new Event Registration > Configure the event > Save

Fields on form:

  • Suffix: unique part of event name
  • Event name: Automatically created for the Event
  • Table: Database table for the Event
  • Fired by: List of Workflows and scripts calling this Event. This is used for troubleshooting only and not for Event processing
  • Description: Documents the Event purpose. Be sure to put a meaningful description for future reference. If you alter the meaning of an Event, update this field
  • Queue: The event processing queue which manages this Event. If left blank the Event goes to the default queue. User-defined queues should be all lowercase and use underscores to separate words
Creating an Event - Workflow

The record that triggered the Workflow is automatically passed when the Create Event Activity is generated

Fields on form:

  • Event_name: Name of Event in Registry
  • Parm1: optional parameter used to pass a string. If you don't need to pass this paramteer the convention is to pass gs.getUserID()
  • Parm2: optional parameter used to pass a string. If you don't need to pass this parameter the convention is to pass gs.GgetUserID()
  • ** parm1 and parm2 can be strings ("hello world"), properties (current.short_description), variables (myString) or methods (gs.getUserID())**

Generating an Event - Script

Use a GlideSystem method:

  • Gs.eventQueue("<even_name>",object,parm1,parm2);
  • Example: gs.eventQueue("x_snc_claims.overdueClaim",current,myString1,gs.getUserName()); 

Checking for and Responding to Events

1. Check: Look for generated events in System Logs > Events

  • Parm1 and Parm2 show resolved values
  • If the queue field is blank, the event was processed by the default queue
  • Created is the time when the event was added to the queue; Processed is the time when the event was processed
  • Processing duration shown in milliseconds

2. Respond

Email

  • Body
  • Receipts
  • Triggered by an event

Script actions

  • Server-side script
  • Triggered by an event occurrence

3. Field names:

  • Created: Date and time of the event for the locale of the machine running the  ServiceNow instance
  • Name: name of event
  • Parm1: event-specified value that depends on the event and the recipient
  • Parm2: Event-specified value that depends on the event and the recipient
  • Table: Database table acted on by this event
  • Processed: Date and time the event was processed. Reflects the locale of the machine running the ServiceNow instance
  • Processing time: Time taken to process this event in milliseconds
  • Queue: Processor queue name
Outbound Email
  • Send email to select users in response to specific activities in ServiceNow (i.e. record insert or update, event generation
  • Admins can configure: What to send, When to send, To whom it should be sent

Email Notifications - Trigger

  • Configure when to send an email
  • Select the Advanced view related link to see all configuration options
  • To create and edit email: In studio, create a notification > Configure the email notification >Save

Fields on form:

  • Name: Name of email notification. Use standard naming schema to identify custom scripts
  • Table: table whose records or events cause email to be generated and sent
  • Description: Document the email notification
  • Type: Choose EMAIL or meeting invitation
  • Active: if selected, the email notification is enabled in the runtime environment
  • Send when: Choose Triggered, Event is fired, or Record is inserted or updated
  • Event name: name of the Event to respond to (when Event is fired is selected)
  • Conditions: Criteria for sending email
  • Weight: numerical value determining which email to send when multiple notifications are in the outbox for the same record and recipients 

When to Send

Different configuration options when:

  • Record is inserted or updated
  • Event is fired
  • Triggered

If using a record interaction as the trigger:

  • Inserted: when a new record for the table is added to the database
  • Updated: when an existing record is updated in the database

Notification Weight

  • Only notifications with the highest weight for the same record and recipients are sent
  • Notifications with a weight of zero are always sent
  • When multiple notifications are simultaneously triggered for the same record and addressed to the same recipients, the Weight field value is used to determine which Email notification(s) to send and which to skip
  • Notifications with a weight value of zero are always sent
  • Non-zero weight values - only the notification with the highest weight value is sent
  • If multiple notifications have the same non-zero weight value and that value is the highest, all notifications with that value are sent

Who Will Receive

Default view:

  • Recipients can be static or dynamic
  • Recipients do not have to be ServiceNow users

Advanced view:

  • If send to event creator is not selected, email is not sent when the recipient triggers the event
  • Email also not sent to other recipients
  • No log of email is created

Receiving Email - Configuration:

The notification field on the user records determines if users receive email notifications. If send to event creator is not selected, email is not sent to the user who generated the event.

When testing email notifications:

  • Make sure users have notifications enabled in their user record
  • Send email to another user and not yourself unless Send to event creator is selected

What it Will Contain

Default view

  • Specify the Notification content
  • Can re-use existing content
  • Content can be static or dynamic

Advanced view:

  • Modify: Notification content, Send/receiving configuration

Fields

  • Email template: select an email template to re-use existing content
  • Subject: text that appears in the email's subject line
  • Message: content that will appear in the email body
  • SMS alternate: the notification content to send to an SMS device

**To dynamically reference a field value from the record that triggered the Notification, enclose the field name in ${}: ${<field name>}. Use dot-walking to reference field values on related records: ${<field name containing related record>.<field name>}. To reference the event parameters parm1 or parm2, use this syntax: ${event.parm1} or ${event.parm2}**

Adding Links to a Message

Links reference the record that triggered the notification or a related record

  • ${URI}: click the word LINK to open the record
  • ${URI_REF}: Click the Display Name to open the record
  • ${<reference_field_name>.URI}: click the word LINK to open a related record
  • ${<reference_field_name>.URI_REF}: click the Display name to open the related record

Testing Notifications

  1. After creating an Email Notification, select the Preview Notification button
  2. Select the Event Creator from the choice list
  3. Select the record to use for testing from the Preview Record choice list
  4. Examine the recipients, subject and message body

Script Actions:

Respond to Events

2 Objects: 

1. Current = object passed in from gs.eventQueue()

2. Event objection: parm1, parm2

Fields on form

  • Name: name of the new script action
  • Event name: event to which the script action responds
  • Active: select this option to put the Script action into runtime. This option is NOT Selected by default
  • Condition script: Javascript condition for script to execute. The script only loads if the condition tests true
  • Script: server-side JavaScript logic to execute if the condition tests true

Use this code fragment to see all the properties and values of the event object (you will get an ignorable warning from the syntax checker):

Var output="; for (property in event) {output +=property +':' +event[property]+',';} gs.info(output);

Script Includes:

  • Reusable server-side JavaScript
  • Library of functions
  • Not executed unless called
  • Use a Script Include to store an application's functions: Only one place for code, Debug in one place, Initialize function gives access to standard set of data

 Property Policy

  • Safeguard intellectual property by making artifact logic read-only or not visible
  • Only applies when applications are installed from the ServiceNow App Store
  • Does not prevent other developers on the application development instance from viewing or editing application artifacts

Use Protection Policies to protect intellectual property by preventing modification or hiding Script Include logic

The Protection Policy options are:

  • --None--: logic is viewable and editable
  • Read-only: logic is viewable but not editable
  • Protected: logic is not viewable 

Anatomy of a Utils Script Include

  1. Create class
  2. Create prototype: Initialize function >Other functions
  3. Include Utils Script Include
  4. Call Utils Method 

1. Create Class and Prototype

  • Script Include name must match class name
  • The prototype function contains logic all objects instantiated from the class will have access to

2. Initialize Function

  • The initialize function is automatically invoked when Javascript objects are instantiated
  • Any object instantiated from the class with have access to the variables defined in the initialize function 

3. Utils function

  • Functions can be called from other scripts
  • Have access to initialize function variables
  • As best practice, note the purpose, parameters, and return value of a function in the Script include

4. Calling Utils Functions

  • Instantiate an object from the Script include class
  • Call script include methods

Good Practices:

  • Automate as many process steps are possible to avoid human error
  • Virtualize processes with Flow Designer or Workflow
  • Use application properties to manage configurable application settings
  • Use scheduled script executions with events and email to execute script logic on a time basis and notfy stakeholders
  • Create a Utils script include to store scripted functions

VII. Import and Integrate External Data

A. Import Data

Before Importing Any Data:

  • Understand what data is coming in and where it should be placed
  • Plan time before an import to verify the data: Correct inaccurate data, delete undesired or inaccurate data
Importing Data via Guided App Creator
  • Creating a table from a spreadsheet during the application creation process:
  1. Create table from upload spreadsheet
  2. Upload XLSX - indicate which row contains the column headers. The default is set to 1. To include the data, make sure to select the import the spreadsheet data option
  3. Define Schema - if the field type is not listed, create a system property sn_g_app_creator.field_types and set the value to the field type
  4. Create table
Process for Importing via Import Set:

Data Source: Load Data --> Import Set Table (IST): Create Transform Map--> Transform map: --> Run Transform

 **If you do not use the import option during Guided Application Creator, Import Sets provide a mechanism to pull data into ServiceNow. Import sets store data in Import Set tables. The import process skips records when the data in the instance is the same as the data being imported**

Loading Data into an Import Set Table - Excel
  • Data is loaded into a staging table and not directly into the final destination
  • All content from a worksheet is loaded into the staging table
  • Not all data from the staging table has to be copied to the final destination
  • Data Source --> Load Data --> Import Set table
 To create a New Import Set Table
  1. In the main SN browser window, open System Import Sets > Load Data
  2. Select the Create table option
  3. Provide a name for the Import Set Table by putting a value in the Label field. The Name field is automatically populated
  4. Select the Choose File button: Navigate to the file you want to upload > Select the open button
  5. Set the Sheet number
  6. Set the Header Row number
  7. Select the submit button
Create Transform Map

A Transform map maps data from the source (import Set) table to the target table

  1. After importing data, select the create Transform map related link or create a Transform map in studio
  2. Configure the Transform map
  3. Save

Field names

  • Name: Provide a name for the Transform Map
  • Source table: Select the Import Set (Temporary) table
  • Target table: Select the table into which records will be copied
  • Run business rules: Select to run business rules, workflows, approval engines, auditing and field normalization while the transformation inserts or updates data into the target table
  • Enforce mandatory fields: choose whether to enforce mandatory fields on the target table
  • Copy empty fields: choose this option to clear fields with existing values when an incoming field contains an empty value
  • Create new record on empty coalesce fields: choose this option to create a new record when all coalesce fields are empty 
Auto Map/Mapping Assist

Match fields on the Import Set table to fields on the target table

  1. Automatic (if field names match): simplest mapping method where all of the field names of the Import Sets match the names of the fields on the target table. Click Auto map matching fields in the Related List in the Table Transform Map form and confirm proper matching. If there are discrepancies in terms of how fields were automatically matched, these can easily be corrected using the mapping assist utility
  2. Mapping Assist Utility: provides a visually intuitive environment for specifying mapping between import set fields and production table fields. With the mapping assist utility it is possible to map a single source field to multiple destination fields

To manually map fields:

  1. Select the mapping assist link
  2. Select a field from the source list and select the Add button
  3. Select the matching field from the target list and select the Add button
  4. Save
Coalesce

The coalesce option makes a field a record's unique key

  • If a match is found using the coalesce field, the existing recording will be updated with the information being imported
  • If a match is not found, then a new record will be inserted into the database

More than one field can be a coalesce field

  • A coalesce field is not required
  • Select the checkbox to match records in the source table to existing records in the target table. When true, the Import Set application attempts to match source values to existing target values. When false, the Import Set application always creates new records for each transformation
  • If multiple fields are set to coalesce, all coalesce values are used to match an existing record
  • If two fields are set for coalescing and a matching value is found on one of the coalescing fields but not the other, a new record is inserted 
Transform

Transforming copies data from the Import Set table to the Target table using the Map(s)

  • To transform data:
  1. Select the Transform Related Link
  2. Select the Import set to copy records from
  3. Select the Map(S) to use when copying
  4. Select the transform button
  5. When the transformation is complete, choose a link from the Next Steps… section: ISETXXXXXXX Go to the import set > transform history: show the transform history, related errors and log > Import log: View the import log

B. Web Services

What are web services?
  • Web-based method allowing applications to connect to other software applications over a network
  • Exchange information between service providers and service consumers.
  • HTTP-based Web services allow diverse applications to talk to each other.  ServiceNow supports both inbound (provider) and outbound web service (consumer) services
Consumers vs. Publishers
Consumer (Consuming):
  • Consuming a web service means a web service user can interact with a published web services
  • Based on the WSDL definition and security restrictions, it can create, read, update or delete records (CRUD operations)
  • Can be accomplished by creating a new Outbound REST Message
  • Invokes/consumes published web services
  • ServiceNow can invoke a web service from multiple areas within the platform including Business rules, UI Actions, Client Scripts, Workflow and Flow Designer
Publisher (Provider/Producing):
  • Publishing a web service means enabling a web service user (consumer) to locate the service description
  • Instructs the consumer how they should interact with the web service
  • Can be accomplished by creating a new Inbound Web Service
  • Publishes web services for clients to invoke
Configuring a REST Message:
  • Used to develop, prototype and save outbound REST messages
  • Reusable in business rules, email notifications and other server-side scripts
  • To configure a Web Services Consumer:
  1. In studio, create a new application file of type REST Message
  2. Configure the REST message
  3. Select the submit button
  • Name: name of REST message
  • Endpoint: the URL of the data to be retrieved, updated, or deleted
  • Authentication type: Choose Non, Basic or Oauth 2.0
  • Use mutual authentication: establishes trust by exchanging Secure Socket Layer (SSL) certifications
  • Application: Set the application Scope
  • Accessible from: Choose this application scope only or all application scopes 
HTTP Methods
  • After saving a new REST Message, the HTTP methods become available
  • Used to retrieve, update, create, and delete data at the endpoint
  • User must be authorized to access data
  • **The HTTP methods do not appear on the REST Message form until the record is saved for the first time**
Examining Parameters for an Endpoint
  • You must understand what information a web service provider expects, read the provider's documentation
  • You must provide values for the required variables.
Giving Values to REST Message Functions
  • To configure a REST Message HTTP Query Parameter:
  1. In the REST Message, select the HTTP method of interest
  2. In the HTTP Request section, scroll to the HTTP Query Parameters section
  3. Provide a Name value matching a variable from the endpoint API documentation. Do not include the equals sign (=) which will be inserted automatically at runtime
  4. Add a Value for the name. Enclose the Value in ${}. At runtime, a dynamically determined value is substituted for the value
  5. Save
Testing REST Message Functions
  • Select the Test link
  • Configure the Variable Substitutions prior to testing. There must be a Variable substitution for all required HTTP Query Parameters

Determine if it worked

  • HTTP Status of 200 indicates post was successful but does not mean the expected results were returned.
  • The parameters field shows the variables passed at the end of the endpoint (you may have to increase the field size to see all parameters and values)

Preview Script

  • Server-side code stub generated automatically
  • Code stub posts only; does NOT extract variable values

Posting from a Script

  • Can dynamically pass REST Message Parameter values
  • Can post from any server-side script 

Extracting Information from the Response

  • REST Response can be either JSON or XML
  • Response is extracted from the returned data
  • Must understand structure of returned data in order to extract values 
Integrating to a ServiceNow instance Table
  • ServiceNow tables can be Web Service Providers
  • Application Access enables/disables Web Service Access
  • The "Allow access to this table via web services" option is only selectable if the Accessible from option value is "all application scopes"
REST API Explorer
  • Creates endpoints, methods, and variables used to send REST Requests to a ServiceNow Instance
  • Open System Web Services > REST > REST API Explorer
  • ** The REST API Explorer interacts with records in the SN instance database. DO NOT practice with the REST API Explorer on a PROD instance
Table API
  • Allows you to query, create, update, and delete a table's records
  • Cannot change the instance when exploring but can from a script
  • Is the default API in the REST API Explorer
Configure Query Parameters
  • Configure the endpoint variables using Query parameters
  • Select the database operation before configuring
  • For complex queries, use the filter builder on a table's list to build the query. After running the query, right-click on the breadcrumbs and select Copy Query. Pass the query into the sysparm_query field
Testing the Web Service
  • Select the Send button at the bottom of the REST API Explorer form to test the web service
  • Results appear at the bottom of the form
  • The Response is returned in the format specified in the configuration parameters
Scripted API Call
  • The REST API Explorer creates stub code for using REST to interact with ServiceNow tables
  • The stub code does not extract information from the web service response. App developers will have to write the code for processing the response
  • User the Select Snippet button to copy the script. Do not use your mouse to highlight the script and copy as that can cause character substitution for some special characters.
Web Service Access Only
  • Web service access only prevents users from logging into ServiceNow user interface
  • The internal integration user option is used to bypass the Web Services Security (WSS) system property setting
Posting from an Email Notification
  • Enclose script in <mail_script> </mail_script> tags
  • Print values to the email with the template.print() method
  • There is no ability to syntax check a script in the Email Notification Message field. Develop your script in a Business Rule and copy it to the Email Notification after testing. Remember to change any gs.info(), gs.debug(), gs.warning(), or gs.error() methods calls to template.print() in the email notification
Notification Script
  • Scripts are not stored in notification
  • Required syntax automatically inserted
  • Notification scripts are reusable
  • To view or modify notification scripts, in the main SN window open System Notification > Email > notification Email scripts
  • There is no mechanism for testing Notification email scripts other than generating email. To speed up development and debugging, it is recommended to develop Notification email scripts first as Business Rules to allow for easy testing
Recommendations:
  • Always clean up data before importing to ServiceNow
  • Understand the format/structure/contents of data before importing it into ServiceNow
  • When importing, determine how you will coalesce to avoid duplicate records
  • Study and understand what data a web service expects to receive and the format and structure of the response
  • Test REST message functions in servicenow before scripting actions on the function
  • Do NOT Practice with the REST API Explorer in PROD

VIII. Testing with ATF

Software Testing Life Cycle
  1. Requirements Analysis
  2. Test Planning
  3. Test Case Development
  4. Environment Setup
  5. Test Execution
  6. Test Cycle Closure
Testing Options:

Test Management Application

  • Tool for manual software testing
  • Test Management 1.0: covers user acceptance testing
  • Test Management 2.0: covers data model structures that match industry standards. Provides an intuitive user interface called the Test Board where you can structure test plans and plan the phases of your testing effort

Automated Test Framework

  • Tool for automatic software testing
  • Unit testing
  • Can be used for regression testing, test driven development, or other SN Testing requirements
  • Enables you to create and run automated tests to confirm that your instance works after making a change

Script debugger

  • Enables users with the script_debugger role to debug server-side JavaScript. It is the primary strategy for debugging Business Rules and other synchronous server-side scripts. Can pause any server-side script that runs in an interactive transaction such as business rules, script includes, script actions, or UI actions that require a response to proceed. 

Test Management

  • Manual tests
  • Manage all phases of the testing process
  • Test repository: Test, Test cases, Test suites
  • Test execution: Test environments, Test plans
  • Test Management is a plugin.
  • To install:
  1. System Definitions > Plugins
  2. Find and select Test Management
  3. Click the Activate/Upgrade related link
  4. Select the Load demo data check box (optional)
  5. Click the activate button
  • Test: collection of conditions or steps used to determine if a feature is working as exptected
  • Test case: collection of related tests
  • Test suite: repository of test cases
  • Test environment: instance where testing with take place
  • Test plan: tasks for how a product or feature is to be tested. A test plan includes the test case(s) and test environment 
Automated Test Framework
  • Create and Run Automated tests : Multi-browser testing via Test Runner
  • Customizable: No scripting or Scripting
  • Save time: Reduce timeframe of manual testing and eliminate risks
  • Rollbacks: Tracks and deletes data created by running tests
  • Upgrade safe
  • Because the ATF is in the platform: It will work after upgrades, Browse for testing elements (users, tables, etc), Does not require separate license purchase
  • 1. Create2. Add Steps3. Run 4. View Progress5. View results

IX. Application Development Topics for Further Study 

Service Catalog
  • Categorical listing of things that can be ordered or requested: Individual items or services, submit requests 
Service Catalog Outcomes

Two possible outcomes when selecting items from the service catalog:

1. Record producer service catalog items result in records being added or modified in the database

2. Service Catalog Items result in request items. This outcome is very much like ordering from an online store

Record Producers
  • Special types of Service Catalog Item that create new records in a database table
  • Users answer questions to create a new record
  • Form can include graphics, html, and help
Service Catalog Record Producer Flow
  • Service Catalog is a listing of all products and services users can order
  • Record Producers add records to a database table using the Service Catalog UI rather than a form 
Service Catalog vs. Forms
Service Catalog:
  • Application used to order a product or service
  • Users can order by answering a few simple questions
  • Your user interface requires HTML, links or graphics
  • Your users are not highly technical
Forms:

Users need:

  • Access to lists
  • Access to context menus
  • To be able to personalize the user interface
  • To edit existing records
Creating a Record Producer
  1. In studio, open the application for editing
  2. In the application explorer, open Data Models > Tables > <table of interest>
  3. Select the Add to Service Catalog Related Link
  4. Configure the Record Producer
Configuring a Record Producer

After configuring the record producer, it is immediately available in the Service catalog

  • Name: text that will appear for this item in the service catalog
  • Short description: text that will appear in a pop-up window when a user hovers the mouse over the item
  • Category: category the item will appear in
  • Selected: variables (fields) that will appear on the Record producer form
Default Record Producer Form

The add to Service Catalog related link creates a default form. The form is customizable:

  • Modify text at the top of the form
  • Change variable (field) text
  • Add help
  • Adjust column layout 
Customizing a Record Producer Form
  1. In studio, open the record producer for editing
  2. Modify the description field to change the text/images/formatting at the top of the Record Producer form
  3. Scroll to the variables section
  4. Open each variable and modify the question field so it contains a question or easily understandable text to prompt a user
  5. (Optional) Select the Help tag to add help to a variable. The text that appears in the Help tag field will be a clickable link on the record producer form. Use the Help text field to write what will appear when a user clicks the help link
  6. Save
  7. Choose the Try It link to preview or test the Record Producer form
Layout Options
  • One column wide
  • Two columns wide, alternating sides
  • Two columns wide, one side then the other
Creating a Two Column Layout
  • Sections are defined with Container Start and Container end variable types
  • To customize a record producer form:
  1. In the form, scroll to the variables section
  2. Select the New button
  3. Configure the start of the new layout: Type: Container Start > Name: <yourchoice> (no spaces) > Layout: <choose a layout option> > Display title: Select to add a section header > Question: text to display on section header if Display title is selected
  4. Configure the end of the layout: Type: Container end > Name: <yourchoice> (no spaces)
  5. Save
  6. Order the container start and end by editing the Order column in the variables list
  7. Choose the preview item link to preview the Record Producer form 
Catalog UI Policy
  • Enhance user experience with Record producer forms
  • Can make fields mandatory, read only, or visible: No scripting is required for this
  • If you want to write a client-side script as part of a Catalog UI Policy, select the Advanced View Related Link to display the Script Field
Catalog Client Script:

Use client-side scripting to enhance user experience with Record Producer forms

Catalog Client Scripts, like Client scripts are used to manage the user interface and user experience

  • Validate data
  • Make variable fields read only, mandatory or visible
  • Get/set variable values
Scripting a Record Producer
  • Server-side script that executes after a Record Producer is submitted and before the record is written to the database
  • Access fields form a Record Producer using the produce object: producer.myField1
  • The current object is the record that will be written
  • Record producer variable map to fields on current
  • The current object is the new record. It will have as its property values either property values from the producer object if copied in a script or values from the variables
  • **DO NOT call current.update!! When the script executes the current record will automatically be inserted in the database**
Linking a Module to a Service Catalog Item
  • Link type = URL (from arguments)
  • Call the record producer by sys_id in the URL
  • Com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=<Service Catalog Item sys_id here> (do not include the < > characters in the URL)
Where do you want to go next?
  • Service catalogs do not have lists
  • Send users to a pre-determined page when records are submitted
  • The redirect script (producer.redirect = "catalog_home.do?sysparm_catalog=<sys_id of Service Catalog>
  • Modify the script on a record producer to redirect to a logical page. Any valid ServiceNow URL can be passed
Creating a Custom Service Catalog Category
  • Give easily understandable names to categories
  • Use parent categories to create a hierarchy
  • To create a Service Catalog Category
  1. In studio, create a new category file
  2. Configure the service catalog category
  3. Save
  • Title: Name that will appear in Category header bar in the Service Catalog
  • Catalog: Catalog the category appears
  • Location: location where the product/service is available
  • Parent: parent category for a sub-category
  • Active: item is available in the Service Catalog
  • Roles: Role of users permitted to order the Catalog Item
  • Icon: graphic that appears next to the Service Catalog item
  • Description: Text to display when hovering over the item
  • Header icon: Graphic to appear in Category header
  • Homepage renderer: defines how the widget should be rendered on a homepage
 Adding a Category to the Service Catalog
  • Open Self-Service > Service Catalog
  • Select the add content button
  • Choose the category from the list
  • Place the Category on the Service Catalog by selecting an Add here button from the bottom of the dialog bxo
  • Close the dialog box
  • **if a category has no record producers/catalog items assigned to it, it will not appear in the list**
Recommendations
  • Use Service Catalog Record Producers instead of forms for a friendly user interface
  • Restrict access to forms and lists with security and use the Service Catalog as the primary user interface
  • Use the smallest possible number of variables to make the interface lightweight
  • Use clear and easily understood questions to prompt users for input
  • Craft carefully worded questions so your users give appropriate responses
  • Use Catalog UI Policies and Catalog Client Scripts to enhance user experience

Snowycode team
Tags:
No tags found
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Read more