Professional Documents
Culture Documents
ServiceNOW Tutorial 01 Developer Platfor
ServiceNOW Tutorial 01 Developer Platfor
Introduction to an instance
Learn about the main sections of the ServiceNow UI.
Banner
Application navigator
Content
The Edge
The application navigator provides access to all ServiceNow modules and applications.
Figure 2. Application navigator
Users only see applications they are authorized to use. The system administrator role used to develop applications can see all applications and modules.
Selecting a module opens the page, list, or form in the content frame. You can use either the filter or mark favorites to quickly locate applications and
modules. When you use a module it is marked as a favorite. Click the star to toggle favorite status on and off. Click the star next to the filter to show all your
favorites in the navigator.
The content frame displays the page that is selected in the application navigator, for example:
Homepage widgets
Lists that display records in a table
Forms that display a single record
Service catalog of items that can be ordered
The Live Feed social application with posts and other shared content
Knowledge base articles
ServiceNow basics
Learn how to perform basic tasks in the ServiceNow application.
Impersonating a user
Using the Edge
Navigating
Configuring and personalizing
Searching
To perform these exercises, log in to the developer site and access your developer instance, or log in to another instance where you have admin access.
Ensure that you are logged in as the system administrator. You do not need the user’s password to impersonate.
To remove a bookmark, hover over the bookmark and click Edit Bookmark, then click Delete.
Using flyouts
Flyouts open forms, lists, and other pages in a pop-up window without closing the pane in which you are currently working. Flyouts are useful for testing
changes when you are developing an application. Click away from the flyout window in an active pane to close the flyout.
Favorites are marked in the application navigator with a blue star . In this exercise, you will create and access a favorite page and learn how to use
the Edge to set bookmarks.
1. Navigate to Incident > Create New and click the blue star.
Create New is marked as a favorite.
2. Clear the application navigator filter text box.
3. Click the blue star to the left of the filter text box.
The list refreshes with the modules and associated applications that are marked as a favorite.
4. Drag Create New to the Edge and drop it.
Incident > Create New is added to the Edge as a bookmark.
5. Configure the Create New bookmark on the Edge.
1. Hover over the bookmark until the Edit Bookmark pop-up appears.
2. Click Edit Bookmark.
3. Change the title to Create New.
4. Click Image, select a new image, and click Update.
5. Click Update.
6. Add Incident > Open to the Edge.
7. Click Toggle Navigator at the top of the Edge to hide the application navigator.
8. Edit the Incidents > Open bookmark to make it a flyout and add the word Flyout to the title.
When you click a flyout bookmark the list or form opens in a pop-up.
9. Use the bookmarks you created on the Edge to switch between the Create New Incident form and the Open Incident list.
In most tables, you can double-click a field to edit its value directly without having to navigate to a form. Administrators can define which tables and columns are
editable in the list editor. Some field types are never editable inline. For more information, see Administering the List Editor.
Click the underlined value in the first column or the info icon to open a record.
Note: Other underlined fields are references to other tables. Click those values to open the associated record. For example, click the name listed in
the Callercolumn to open the user record.
You can also select multiple records and edit them to, for example, change several resolved issues to closed status.
Sorting records
Click a column label to sort the records in descending order. Click the label again to sort in ascending order. The blue up or down arrow indicates the current
sort field and order.
Lists can be configured for all users or personalized by the current user.
To configure, right-click in the column header and select Configure > List Layout.
To personalize, click the gear icon in the top left.
Searching lists
The Go to search above the list lets you select a field and a string to search for. Wild cards include:
Contains: *mySearchString
Starts with: mySearchString
Ends with: %mySearchString
Does not contain: !*mySearchString
Equals: =mySearchString
Does not equal: !=mySearchString
When you run the filter, the condition builder collapses automatically. To keep it open, click the pushpin button before you click Run.
The breadcrumb is updated to show the conditions, and the list refreshes with matching records. Remove a condition by clicking > next to the condition .
Searching by column
Right-click in any cell to show matching values or to filter out the value. Date fields also let youShow Before and Show After. Alternatively, you can click the
looking glass icon to open the column search fields.
The list refreshes with incidents that match the updated filter.
You are personalizing the Incident > Open list, the same list as in the previous exercise.
1. If not already viewing the Incident > Open list, navigate to it.
2. Click the gear icon above the list on the left.
Figure 1. Gear icon location
3. Select Updated from the Available list and click Add .
Updated appears in the Selected list.
4. Re-order columns by selecting a column in the Selected list and clicking Move up orMove down .
5. Click OK.
The gear icon changes slightly to indicate that the list is personalized.
Continue to use the Incident > Open list for this exercise.
1. If not already viewing the Incident > Open list, navigate to it.
2. Click the Updated column header to sort the list by date of the last update.
The column name changes to blue and the list refreshes with the most recently updated incidents at the top.
3. Click the Updated column again.
The list refreshes with oldest updated incidents at the top.
Forms
A form displays information from one record in a data table. The specific information depends on the type of record displayed. Users can view and edit records
in forms. Administrators can customize forms.
Required fields are marked red with an asterisk (*). Users with permission can edit fields.
Save: Update the record and stay on the current page. Click Save in the header or right-click in the header and click Save.
Figure 4. Save the form
Configuring forms
Forms cannot be personalized by an individual user. However, you can give different functions to different groups who use the same form. For example, end
users report issues in the incident form and IT team members work on the issues. The incident form is different for each group.
Configuring forms will be covered in more depth in Module 4: Customizing the user interface.
01 Developer platform introduction - Module 2 - Creating applications
Application creator
Use the application creator to start building your application.
The application creator creates the project space that tracks and contains all of your application artifacts, from table definitions and scripts to UI layouts and
reference data. Unlike traditional development environments such as Eclipse, ServiceNow does not store artifacts in files on disk. Instead, everything (even a
binary graphic) is stored as rows in tables. While you are developing an application, you will be adding new tables and modifying or extending existing tables in
many places throughout the platform. It is the application creator’s job to keep track of all these changes for you, and bundle them all up into a single zip file
when you are ready to publish your application.
The application creator has changed significantly in the Fuji release. It provides the ability to build applications from scratch, from a basic template, or from a
predefined template. It is recommended that you use the application creator to build applications.
This overview describes what the application creator does. Later in this course you will use the application creator to build an application in your own instance.
Start from Scratch: Nothing is predefined. You must define the application tables, menu, and access controls.
Create custom application: A table, menu, and access controls are provided as a place to start building the application.
Start from a template: Choose from a set of predefined templates for common enterprise applications. Many underlying ITIL business processes are
prebuilt in these templates; you can customize them as needed.
Note: To start from a template, you must activate a plugin. Click the Requires plugin activationbutton and follow the instructions in the linked help topic.
The Create custom application option is used for the examples below.
Note: When Create Table is enabled, the platform automatically generates a basic table and enters a name that is derived from your application name.
After the application finishes building, you see the following screen:
You can also access an application by clicking the gear icon in the upper right corner, selecting the application, and clicking the Show Selected
Applicationicon next to the application name.
Scope: The namespace for the application that lets the system avoid conflicts with other applications and allows for public and private elements of the
application. This is automatically provided and should not be changed.
Menu: The header that shows in the application navigator on the left.
User role: Establishes a default user role for the application. Only logged-in users with the specified role may access the application.
Note: While it is possible to build an application in the global scope, it is highly discouraged for the following reasons:
Always use application scoping unless you have a use-case that explicitly precludes using it.
The Custom Application form is your project’s workspace that contains all associated artifacts. From here you can add tables, additional roles, application menu
items, application files, and dependencies.
Log in to the developer site and access your developer instance or another instance where you have administrator access.
Note: When you create an application, the Application Creator creates a new role (called u_marketing_events_application_user) that you can assign to
users who need access to this application.
6. Click View app record.
The Marketing Events Application opens.
Figure 2. Marketing Events Application
You now have the foundation of the application that you will build out during the rest of the course.
When creating a custom application, ServiceNow stores all application artifacts in a specially-formatted XML document that can be imported into
another ServiceNowinstance. When you want to move applications from one ServiceNow instance to another, you need to publish the application.
Publishing the application packages all artifacts related to the application into an update set. An update set is an XML file that can be imported into the
otherServiceNow instance. That process is called applying the update set.
Provide your custom application to another instance by applying the update set to it
Option Description
If there are errors Examine each error in the Update Set Preview Problems list, and accept or skip the update responsible for it.
Note: You can resolve conflicts row by row, using the Available Actions field, or you can select multiple rows and make a group decision via the Actions on
selected rows… choice list. After resolving all errors, click Commit Update Set.
14. From the application navigator, select Refresh.
15. Navigate to the Marketing Events Application and check the application.
Note: If you are familiar with older versions of ServiceNow, you may want to use traditional update sets (customizations made outside the context of a custom
application) to publish applications. However, this is not possible, because custom application update sets bundle artifacts differently. Always use the technique
from this exercise to create custom application update sets.
When you delete an update record, only the record of the update is deleted. The update is not backed out of the environment. If you have committed an update
set that you do not want to keep in your environment, you have to back out the update set. Backing out either reverts to the previous settings or drops new
fields and tables from the database and deletes new scripts.
Note: Only update sets with state = Complete can be backed out.
You may need to scroll up to see the Back Out button. It is above Related Links.
If a warning message indicates the update set does not belong to the current application specified in your Application Picker, switch to the correct
application from the link in the warning message.
After an update set is backed out, it is safe to delete it.
01 Developer platform introduction - Module 3 - Tables, references, and
inheritance
1. From the Marketing Events Application, scroll to the Tables section and click New.
2. Enter Marketing Event in the Label field.
The Name field populates automatically, based on the label and application name.
3. Create the columns for the table, using the following information.
You can navigate to your new table by performing any of the following options.
Deciding whether or not to base your application on an existing ServiceNow table is an important decision. If you extend an existing table, you inherit the built-in
functionality of the base table. If you create a new table, you can script and configure all of the application behaviors.
You can extend any extensible table in the base system. Many custom IT applications extend the task table because it has many task-related fields, such
as Additional Comments, Approval History, Escalation, Priority, Watch List, and so on. The Task table also uses common business processes such as
approvals, journaling, assignment, inactivity monitors, and service level agreements. If your custom application needs these features, extend the Task table and
add custom fields to it.
Note: Do not change the base system Task table. Extend it by creating a new table that extends from the Task table.
Create a new table if your application is not related to tasks. New tables are created with a default set of required fields and have no pre-defined business rules,
access control lists (ACLs), or workflow logic. After creating a custom table, you can add new columns, business rules, and ACLs at any time.
Note: If your application needs to extend your custom table, check the Extensible check box when you create it. If you don’t check it when you create it, you can
make it extensible later.
An application can use multiple tables, including:
Base table that contains the primary application records
Reference or lookup tables
Use the following to help you decide whether you need to extend an existing table.
Table will contain sample or seeded data that is used only for reference by the application - X
Note: The user approval workflow activity works with all tables. All other approval activities work only with tables that are extended from Task.
1. From the Marketing Event Application, scroll to the Tables section and click New.
2. Enter Equipment Request in the Label field.
The Name field is filled in automatically, based on the label and application name.
Note: The Marketing Event field is a reference to the Marketing Event table. A reference field creates a relationship between two tables and allows you to
display information from another table. It is similar to the primary and foreign keys in a relational database. In this case, a particular piece of equipment is
related to a particular marketing event.
6. Click Submit.
Reference fields
Reference fields store a reference to a specific row in another table, similar to foreign keys in SQL.
An example of a reference field is the Caller field on the Incident table, which is a reference to a specific user in the [sys_user] table.
Users don’t need to understand foreign keys or SQL joins to query reference fields. If a table contains a reference to another table, any field on the referenced
table can be accessed using dot-walking. For example, incident.caller references the name of the user who opened the incident. Dot-walking can be chained
several levels deep, for example, incident.caller.company references the company name of the caller who opened the incident.
Administrators can create new reference fields and configure several options for reference fields, including:
As a developer, you are already familiar with foreign keys and SQL joins used to reference rows in a related table. ServiceNow makes it easy for end-users to
query related tables without needing to know SQL syntax.
Incident table rows contain a field named Caller, which is a reference to the user [sys_user] table. You can search the incident table for all incidents created by
callers who work in the sales department:
The following table highlights differences between reference fields and choice lists:
Reference fields store a reference to a row on another table. For Choice lists present the user with a list of pre-defined choices. Administrators
example, the Caller field on the Incident table is a reference to the User can define the available choices and customize the behavior and appearance of
[sys_user] table. choice lists.
Referenced tables often have many rows Choice lists have a small number of items
Referenced objects can contain a lot of other fields to store information Choice list items contain a friendly name and a value used for scripting
Referenced tables are often updated Choice lists are rarely updated
End users can add rows to referenced tables Only administrators can change choice lists
Choices contain both a friendly label, such as Top Priority, and a value, such as P1, that is used for scripting. This makes it possible to change labels without
having to modify your script code that references the choice field.
Because ServiceNow stores all choice lists in the [sys_choice] table, you can write script code to modify choice lists or import new choices from external data
sources. For a complete reference on managing lists, see Customizing Choice Lists on the ServiceNow Wiki.
For a tutorial on choice list best practices, including an example of re-using a single choice list in multiple places, see https://www.youtube.com/watch?v=I-m-
egREJ5M
Exercise 12: Modify inherited choice list
In this exercise you will build on the Marketing Events application and customize the Choice list that was inherited from the Task table to add a new choice and
remove unneeded choices.
Note: The choices found in the State list are inherited from Task. When rendering the list, the platform uses rows from Choice[sys_choice] that are
associated with Task and are global to all other tables that extend from Task. In the next steps, you will create a new custom set of choices.
3. Right-click State and select Configure Choices.
A choice list editor appears.
4. Enter the following information and click Add.
Field Value
Numeric 10
Value
Note: A value of 10 is important because that value is not already used by the platform and will not interfere with business rules in the
base system.
Forms designer
The ServiceNow graphical forms designer allows you to design and lay out interactive table editor forms with fields from a master table row and lists from
related tables.
You create logic with UI policies to dynamically show and hide fields in forms. It is also easy to add related list tables to a form, so that users can review and edit
one-to-many relationships to the main table row they are editing in the form. You will learn about these features later in this module.
Note: The form design feature is available by default for new ServiceNow instances. For upgraded ServiceNow instances, ask a system administrator to
activate the NG form designer plugin (com.glide.ui.ng.fd) to access the feature.
1. Right-click the title bar of the Marketing Events form and select Configure > Form Design.
2. Drag and drop the items in the order you want them to appear.
3. Add city values.
1. Hover over the City field and click the gear icon.
2. In the Properties dialog box, click Create choices.
3. For Choice 1, 2, and 3, enter Dallas, Kansas City, and London.
4. Click in the empty row and create new entries for San Jose, Portland, andSydney.
5. Close the Properties dialog box.
4. Make the Name field mandatory.
1. Hover over the Name field and click the gear icon.
2. Select the Mandatory check box.
3. Close the Properties dialog box.
5. Click Save.
6. On the Marketing Event form, right-click the title bar, and select Reload form.
A form can display records from other tables that are related to the main record.
Many of the behaviors of related lists are configurable. The following list describes some configurations, but there are many more.
Remove the New button to prevent users from creating new rows in the related table
Hide empty columns
Hide the entire list if it’s empty
Enable grid editing, so that new rows can be created with a double-click
1. In the application navigator, right-click the Marketing Events Application and select Edit Application Menu.
2. Scroll to the Modules section and click the Equipment Requests module.
1. Change the Title to All Equipment Requests.
2. In Hint, enter List of all Equipment Request records in the database.
3. Click Update.
The module name changes under Marketing Events in the application navigator.
4. To add a module, scroll to the Modules related list and click New.
5. Configure the new module as follows:
Option Description
6. Click Submit.
7. Add another module to display only open Equipment Request records.
Be sure to enter a descriptive hint and set the filter appropriately so that only rows whose [State] [is not] [Closed Complete] are shown.
8. Use the Order field in the Modules related list to display the modules in this order: Marketing Events, New Equipment Request, All Equipment Requests,
and Open Equipment Requests.
Number the modules 100, 200, 300, and 400.
UI policies
UI policies are client-side logic that governs field behavior and visibility on forms.
ServiceNow automatically generates client-side Javascript that the browser executes to enforce policies on the form being displayed. Each policy has a
condition that must resolve as true to be executed. Policies determine the following field attributes and behaviors:
Most basic UI policies are declarative and do not require scripting. You may also write your own scripts to handle more complex scenarios.
The UI policy you create for the Incident form does the following when the incident state changes to Resolved.
Option Description
Reverse if false Select this check box. The UI policy is reversed if the incident state is not Resolved.
On load Select this check box to perform the actions when the form is loaded or when the condition changes.
4. Right-click in the header bar and click Save from the context menu.
The UI Policy – Hide “Assigned to” when resolved list appears.
5. Scroll to the UI Policy Actions section and click New.
6. Make the following selections.
Option Description
7. Click Submit.
A new row appears in the related list.
8. Repeat steps 5 to 7 twice to configure each of the following UI policy actions.
Option Description
function onCondition() {
alert('You changed the "Incident state" to
Resolved. Note that location is now mandatory');
}
CSV Imports data from a character-separated values file, such as a comma-separated or tab-separated file.
XLS Imports data from Microsoft Excel spreadsheets at versions 2003 and older.
Note: The import process does not support the XLSX file format for Excel versions 2007 and newer.
XML Imports data from an extensible markup language file, such as records exported from another instance.
Migrate legacy data to an instance when that data is available in a supported Import the legacy data through import sets.
import format. Manage future updates fromServiceNow.
Synchronize data with an external application. Integrate with the external application.
Determine if the integration needs both inbound and outbound
communications.
Perform bulk updates containing many records. Import data to an import set.
Schedule transformation to reduce the performance impact.
Send externally generated records to an instance as the records are created Integrate with a synchronous web service.
or updated. Consider using the REST API if supported by the external
application.
Business requirements
Before you created the Marketing Event application, users tracked events and attendees with spreadsheets. Marketing event coordinators want to migrate this
legacy data to the Marketing Event application.
You can meet these goals by using import sets for the bulk import of legacy data and a transform map to coalesce legacy and existing data.
1. Use a text editor to create a comma-separated values (CSV) file using this data.
Note: XLS is the Excel 97-2004 Workbook format. Do not use XLSX or Excel file format options.
In this first section, you create a source table for the data in the CSV file and a transform map that specifies an existing target table.
Field Value
Sheet number 1
Header row 1
4. Click Submit.
The system displays a success message after importing the file.
5. Click Create transform map.
6. Enter these values.
Field Value
In this section, you map legacy data field labels from the source table to existing field labels in the target table.
In this next section, you specify the name of the marketing event as the unique key during the import. If a match is found, the existing record is updated. If not,
a new record is inserted.
12. From the Field Maps related list, double-click the Coalesce cell for the u_name source field.
13. Set the Coalesce value to true.
The system may display a message about indexing fields.
14. If there is an indexing message, select the options to index the table without notification.
In this last section, you specify the date format of the start and end dates, and then run the transformation to complete the import.
Note: Source tables cannot be created from other Excel file formats, such as XLSX.
Field Value
Sheet number 1
Header row 1
4. Click Submit.
The system displays a success message after importing the file.
5. Click Create transform map.
6. Enter these values.
Field Value
In this middle section, you map legacy data field labels from the source table to existing field labels in the target table.
In this section, you specify email address as the unique key during the import. If a match is found, the existing record is updated. If not, a new record is inserted.
12. From the Field Maps related list, double-click the Coalesce cell for the u_email source field.
13. Set the Coalesce value to true.
14. From the Field maps related list, click u_event.
15. For Referenced value field name, enter name.
16. Click Update.
In this last section, you create a transform script using a supplied codeblock and run the script to complete the import.
17. From the Transform Scripts related list, click New.
18. Enter these values.
Field Value
When onBefore
Script
//Convert source field to string
var name = source.u_name.toString();
//Split names anywhere there is a space
var split_names = name.split (" ");
//Find the number of names
var num_names = split_names.length;
//If there is only one name map it to the last name
if (num_names == 1) {
target.last_name = split_names[0];
}
//if there are two names map to first and last name
if (num_names == 2) {
target.first_name = split_names[0];
target.last_name = split_names[1];
}
//if there are more than 3 names combine into one middle name
if (num_names >= 3) {
target.first_name = split_names.shift();
target.last_name = split_names.pop();
var middle_name = split_names.join(" ");
}
19. Click Submit.
20. In the Related Links list, click Transform.
The system displays the import set and transform map to be used in the transform.
21. Click Transform.
The system imports the data from the Excel spreadsheet into the Attendees table.
Replace legacy marketing event spreadsheets Yes The import set table contains a copy of the
with application records original data.
Transform rules allow you to fix the data
format and input errors.
Replace legacy attendee spreadsheets with Yes The import set table contains a copy of the
application records original data.
Transform rules allow you to fix the data
format and input errors.
Ensure there are no duplicate marketing events Yes Coalescing on the email field and the name
or attendees field ensures there are no duplicate records.
Consider also coalescing on the marketing
event field when you transform the legacy
attendee data to allow the same person to
attend different events.
The sales department uses an external application to track sales prospects. This external application supports REST web services as well as exporting to CSV
text files.
Web services import sets Import set table, such as User[imp_user] Control when data imports into a target table by checking for conditions.
Control how data imports into a target table by applying field mappings.
Transform data by using a set of rules.
Keep a record of data imports for auditing.
Support REST and SOAP web services.
Support JSON, CSV, Excel, and XML as input formats.
Direct web services Production table, such as User [sys_user] Access any table without having to configure an endpoint.
Perform database operations directly on tables.
Support REST and SOAP web services.
Support JSONv2, CSV, Excel, XML, PDF, and RSS as output formats.
Scripted web services Production table, such as User [sys_user] Use JavaScript to define input and output parameters.
Specify an arbitrary endpoint URL.
Support XML output only.
ODBC Driver Production table, such as User [sys_user] Allows connections from an ODBC client.
Uses a query-only web services interface.
In this section, you create the inbound web service and the import set table.
Name x_snc_marketing_ev_add_attendees
3. From the Web Service Fields embedded list, double-click Insert a new row to enter these field values.
In this section, you create a transform script from a supplied codeblock to import data from a source field that has no match in the field maps.
When onBefore
Script
//Convert source field to string
var name = source.u_name.toString();
//if there are two names map to first and last name
if (num_names == 2) {
target.first_name = split_names[0];
target.last_name = split_names[1];
}
//if there are more than 3 names combine into one middle name
if (num_names >= 3) {
target.first_name = split_names.shift();
target.last_name = split_names.pop();
var middle_name = split_names.join(" ");
}
8. Click Submit.
From the REST API Explorer, you can select and test the following REST APIs.
Table API
Retrieve records from a table (GET)
Create a record (POST)
Retrieve a record (GET)
Modify a record (PUT)
Delete a record (DELETE)
Update a record (PATCH)
Aggregate API
Retrieve statistical calculations for a table (GET)
Import Set API
Create a record in an Import Set staging table (POST)
Retrieve an Import Set record (GET)
All REST APIs give you the option to use the current user’s credentials or provide another user’s credentials. The REST API requires the following user roles.
rest_service
Table API
Aggregate API
import_admin
Import Set API
The REST API Explorer provides sample code to execute requests from external applications. It supports these code languages.
ServiceNow Script
cURL
Python
Ruby
JavaScript
Perl
1. Navigate to System Web Services > REST > REST API Explorer.
The system displays the REST API Explorer form and the Table API.
Note: If you receive a one-time message describing the REST API Explorer, click Explore.
Figure 1. REST API Explorer
2. From the API list in the left panel, select Import Set API.
The system displays information for Create a record in an Import Set staging table (POST).
3. In the Prepare request section, confirm these default values.
Field Value
Authorization Send as me
Note: As an admin user, you automatically have the user roles necessary to use REST services. If you want to use another user’s credentials, verify the
user has the rest_service and import_admin user roles. See Creating Users and Associating to a Group.
4. In the Path Parameters section, for stagingTableName, selectx_snc_marketing_ev_add_attendees.
5. In the Request Body section, enter these values.
Field Value
u_email jr.ewing@ewingoil.com
The fields and values you entered begin to build the request script dynamically.
6. At the bottom of the Request Body section, click [cURL].
The system displays a sample cURL command based on your entries so far.
Note: You can copy this code and modify it to call your instance with your user credentials.
Figure 2. Sample cURL command
The system displays Request and Response sections. The Response section displays the Status Code201 Created.
There is a record for jr.ewing@ewingoil.com. The record extracted the First name and Last namefields from the full name provided in the REST request. Also,
theMarketing Event field for that record now references the Dallas LUG.
Exercise 9: Update attendee
Simulate sending a REST message because of a record change on an external application. The message changes the existing attendee record.
1. Navigate to System Web Services > REST > REST API Explorer.
The system displays the REST API Explorer form and the Table API.
2. From the API list in the left panel, select Import Set API.
The system displays information for Create a record in an Import Set staging table (POST).
3. In the Prepare request section, enter these values.
Field Value
Authorization Send as me
Note: As an admin user, you automatically have the user roles necessary to use REST services. If you want to use another user’s credentials, verify the
user has the rest_service and import_admin user roles. See Creating Users and Associating to a Group.
4. In the Path Parameters section, for stagingTableName, selectx_snc_marketing_ev_add_attendees.
5. In the Request Body section, enter these values.
Field Value
Note: Changing the value of the u_name field simulates the update to that record from the external system.
6. At the bottom of the Request Body section, click Send.
7. In the confirmation dialog, click OK to modify data.
8. The system displays Request and Response sections.
Automatically create an attendee record from a sales Yes The inbound web service automatically runs the transform map to insert records.
prospect. The external application needs to know the endpoint URL and message format.
Automatically update attendee details when a sales Yes We could use the sample code provided by the REST API Explorer to create valid
prospect changes. REST messages from an external application.
The REST API Explorer also provides the proper format for inbound REST
messages.
Automatically update attendee details when there is No The transform map treats all valid REST message requests as inserts.
an existing attendee record. Need a mechanism to identify when a REST message updates an existing record.
Coalescing records
In the context of transform maps and import sets, to coalesce means to use one or more unique keys to determine if there is a matching record in a target
table.
If an import set record coalesces to an existing record, the system updates the matching record in the target table. If an import set record does not coalesce,
the system creates a new record in the target table.
Each transform map contains a Field Maps related list, and each field map contains a Coalescefield. Setting the Coalesce field to true indicates that this field
contains uniquely identifying information for the target record.
For example, in the baseline system there is a transform map for the User [sys_user] table that coalesces on the email field.
For example, in the baseline system there is a user record for Abel Tuter with the email address abel.tuter@example.com.
Whenever a user import set record contains this email address, the system updates Abel Tuter’s user record with the other field values from the import set
record.
Some transform maps use multiple coalesce fields to indicate that unique information is spread across multiple fields. For example, what makes a marketing
event unique is the name and date of the event. So the Dallas LUG on May 15, 2015 is distinct from the same event on October 5, 2015, but is also distinct
from a New York LUG also on May 15, 2015. The combination of the name and date however, uniquely identifies the record.
1. Navigate to System Web Services > REST > REST API Explorer.
The system displays the REST API Explorer form and the Table API.
2. From the API list in the left panel, select Import Set API.
The system displays information for Create a record in an Import Set staging table (POST).
3. In the Prepare request section, enter these values.
Field Value
Authorization Send as me
Note: As an admin user, you automatically have the user roles necessary to use REST services. If you want to use another user’s credentials, verify the
user has the rest_service and import_admin user roles.See Creating Users and Associating to a Group.
4. In the Path Parameters section, for stagingTableName, selectx_snc_marketing_ev_add_attendees.
5. In the Request Body section, enter these values.
Field Value
Note: Changing the value of the u_name field simulates the update to that record from the external system.
6. At the bottom of the Request Body section, click Send.
7. In the confirmation dialog, click OK to modify data.
The system displays Request and Response sections. In the Response, notice that theStatus Code reads 201 Created.
8. Navigate to Marketing Event > Attendees.
Figure 1. Updated attendees table
There is only one Attendee record for jr.ewing@ewingoil.com and the First name is now J.
Automatically create an attendee record from a Yes The inbound web service automatically runs
sales prospect. the transform map to insert records.
The external application needs to know the
endpoint URL and message format.
Automatically update attendee details when a Yes We could use the sample code provided by
sales prospect changes. the REST API Explorer to create valid REST
messages from an external application.
The REST API Explorer also provides the
proper format for inbound REST messages.
Automatically update attendee details when there Yes The transform map can identify import set
is an existing attendee record. records that match an existing attendee.
The transform map updates other field
values such as the name.
02 Integrating with ServiceNow - Module 3 - Outbound web services
Marketing events are a good place to find new sales prospects. The sales team would like to:
Identify marketing event attendees who are not already sales prospects.
Send attendee details to the external application whenever an attendee is added or changed.
Indicate an attendee record has been sent to the external application.
Field Value
Name sales_prospect
Default Cleared
When onBefore
Order 200
Script
//Set sales_prospect to true
target.sales_prospect = true;
Field Value
Name x_snc_marketing_ev_sales_prospect
Name string
Company string
Email string
Phone string
Region string
Field Value
Name x_snc_marketing_ev_add_sales_prospect
The Create Web Service form displays a row for each web service field you added.
Figure 1. Added web service fields
4. Click Create.
The system creates the import set table Add Sales Prospect [x_snc_marketing_ev_add_sales_prospect] and the endpoint
URLhttps://<instancename>.service-now.com/x_snc_marketing_ev_add_sales_prospect.do?WSDL, and then displays the Table Transform Map form.
Figure 2. Table Transform Map for new inbound web service
5. Under Related Links, click Auto Map Matching Fields.
The system displays the Field Maps related list with a list of matching fields.
6. Double-click the Coalesce cell for the u_email row, and set the value to true.
7. Click the green checkmark to save the transform map.
8. From Related Links, click Index Coalesce Fields.
The system displays a Create a New Index confirmation pop-up window.
9. Select Do not notify me.
10. Click OK.
The system schedules the creation of an index.
11. Click OK.
Since we do not actually have an external application to receive the outbound message, we will use the Import Set API as our target endpoint.
Field Value
4. From the HTTP Headers embedded list, double-click Insert a new row… to enter these headers.
Name Value
Content-Type application/json
Accept application/json
Field Value
Content
{
"u_name":"${u_name}",
"u_company":"${u_company}",
"u_email":"${u_email}",
"u_phone":"${u_phone}",
"u_region":"${u_region}"
}
8. Click update.
9. From the Variable Substitutions related list, click New.
10. Enter these values.
Note: You must click New for each substitution.
The purpose of this business rule is to send an outbound REST message whenever an attendee is created or updated.
Field Value
Name Add Sales Prospects
Advanced Selected
When Async
Insert Selected
Updated Selected
Script
function onAsync(current) {
//This function will be automatically called when this rule is processed.
try {
//Combine first and last names
var fullname = current.first_name + ' ' + current.last_name;
var r = new sn_ws.RESTMessageV2('x_snc_marketing_ev.Synch Sales Prospects',
'post');
r.setStringParameter('u_email', current.email);
r.setStringParameter('u_name', fullname);
r.setStringParameter('u_phone', current.phone);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
current.sales_prospect = true;
current.update();
}
catch(ex) {
var message = ex.getMessage();
}
}
4. Click Submit.
Field Value
Email guy.fawkes@anonymous.org
9. Click Update.
The system displays the Attendees list.
10. From the Attendees list, click guy.fawkes@anonymous.org.
The attendee record appears, with the Sales Prospect field selected.
Figure 2. Attendee record for Guy Fawkes
11. Navigate to Marketing Event > Sales Prospects.
The system displays the current list of Sales Prospects.
Figure 3. Sales Prospects table
Two of the sales prospects match the Attendee records you inserted and updated.
Send attendee details to the external application Yes The asynchronous business rule creates an
whenever an attendee is added or changed. outbound REST message for each attendee
addition or change.
The Attendee table could have additional
fields to match sales prospect details such
as company and region.
Indicate an attendee record has been sent to the Yes The asynchronous business rule
external application automatically sets the Sales Prospect field
after sending a REST message.
Creating a custom processor to act as the endpoint of the URL query. The system parses the URL query to identify the following components.
Table name on which the processor acts
Input parameter name
Input parameter value
Using the scoped API to calculate how many attendee records there are for a specified marketing event.
Processors
ServiceNow processors are analogous to Java servlets. Processors provide a customizable URL endpoint that can execute arbitrary server-side JavaScript
code and produce output such as TEXT, JSON, or HTML.
Typically, you create custom processors when you want a URL query to:
By default, processors are public and can execute without requiring authorization. This means that any logged-in user can execute the processor without
needing a particular role. To prevent leakage of secure data, protect your processors with ACLs (Access Control Lists) that restrict their use to users with an
authorized role.
Requirement Recommendation
Perform basic operations such as create, read, update, or Use an existing web service, such as the REST API, or use an existing processor, such
delete records. as Export to PDF.
Field Value
Name getAttendance
Type Script
Parameters mrkevent
Path getAttendance
Script
g_response.setContentType('text/html;charset=UTF-
8');
var numOfAttendees = 0;
var attendees = new
GlideAggregate('x_snc_marketing_ev_attendee');
attendees.addQuery('marketing_event', sid);
attendees.addAggregate('COUNT');
attendees.query();
if(attendees.next())
numOfAttendees =
attendees.getAggregate('COUNT');
setContentType(‘text/html;charset=UTF-8’) A HttpServletResponse method to set the content type of the response being sent to the client.
SeeInterface HttpServletResponse.
canRead() A GlideRecord method to determine if the user can read data from a table. SeeScoped GlideRecord API
Reference.
For example:
https://dev20118.service-now.com/x_snc_marketing_ev_getAttendance.do?x_snc_marketing_ev_mrkevent=2721380c0f3631004f2009bce1050eab
Calculate a marketing event’s attendance from a Yes Could rewrite the processor to use a
URL query. marketing event name rather than a Sys ID.
There are script actions that already
calculate this information based on events.
Could use a web service instead of a
processor to query the Attendee table.
Display calculation results in the client. Yes This information might be better displayed in
a field.
Could display result as a numeric value for
use by an external application or process.
Field Value
Name odbc
Role
itil
soap
x_snc_marketing_ev_attendee_user
x_snc_marketing_ev_equipment_request_user
x_snc_marketing_ev_marketing_event_user
7. Click Save.
8. Log in to a supported Windows system or virtual machine.
9. Navigate to KB0540707 on HI.
The browser displays the ODBC Driver Installer knowledge article.
10. From Available versions, click Download next to the ODBC driver version you want to use.
Figure 1. ODBC drivers
11. Open the ODBC Driver installer on the Windows machine and follow the on-screen instructions.
12. Navigate to Start > Programs > ServiceNow ODBC > Management Console.
13. From the left pane, navigate to Console Root > OpenAccess SDK 6.0 Manager >[installation location] > Services > ServiceNow_ODBC > Data Source
Settings>ServiceNow > IP Parameters.
14. Double-click the DataSourceIPProperties attribute.
The Properties dialog box opens.
15. In Value, enter the URL of your instance.
16. Click OK.
1. In Windows, navigate to Start > Programs > ServiceNow ODBC > ODBC Administrator.
2. Click the System DSN tab.
3. Select the ServiceNow data source.
4. Click Configure.
Windows displays an ODBC Driver Setup dialog box.
5. Click Test Connection.
6. Enter the ODBC user credentials you created.
Note: The password field is limited to 18 characters.
7. Click OK.
Windows displays a success message.
1. In Windows, navigate to Start > Programs > ServiceNow ODBC > Interactive SQL (ODBC).
2. Enter the following command to connect to the ServiceNow instance.
connect odbcuser*password@ServiceNow
Note: Replace odbcuser and password with the ODBC user account name and password created earlier.
3. Enter the following command.
select marketing_event from x_snc_marketing_ev_attendee;
4. Press Enter.
The ODBC Driver returns an error message about not finding column information.
Figure 1. ODBC driver error message
Field Value
5. Click Update.
1. In Windows, navigate to Start > Programs > ServiceNow ODBC > Interactive SQL (ODBC).
2. Enter the following command to connect to the ServiceNow instance.
connect odbcuser*password@ServiceNow
Note: Replace odbcuser and password with the ODBC user account name and password created earlier.
3. Enter the following command.
select marketing_event from x_snc_marketing_ev_attendee;
4. Press Enter.
The ODBC Driver returns results. Notice that the query returns raw database values instead of display values. In this case, the query returns the 32-
character sys ID of the marketing event.
Figure 1. ODBC query results
5. Enter the following SQL command to alter the Attendee table.
alter x_snc_marketing_ev_attendee drop column email;
The ODBC Driver displays a syntax error message.
Figure 2. ODBC driver syntax error message
Support ODBC queries of marketing event data. Yes Queries return only database values not display values.
Reference and choice fields are not good candidates for ODBC queries.
Queries require knowing column and table names rather than labels.
Support a read-only connection to the instance. Yes Cannot run ALTER commands.
Cannot run DROP commands.
Cannot run CREATE commands.
02 Integrating with ServiceNow - Module 6 - Considerations and
conclusions
Import sets Importing bulk data from external Web service import sets allow you to restrict direct web service access to an application
files table.
Application-specific web services Web service import sets automatically apply transform maps.
Transform Data transformation and clean up Identify the fields that make a record unique and use them to coalesce.
maps Identification of and updates to There are several existing transform maps you can use as templates.
existing records
REST API Proper formatting of REST requests Can eliminate the need for web service client tools.
Explorer Testing inbound REST requests Use to reduce the complexity of scripting REST calls.
Generating sample code Calls bypass application access settings.
REST Communicating with external Use Preview Script Usage to see how to code a REST message.
messages applications REST messages require asynchronous business rules.
Automatically including record values
by using variables
Processors Running arbitrary code from a URL Creating processors requires using the application scope’s namespace identifier in the
Applying an operation to multiple URL.
tables Consider whether web services can accomplish the same goal.
There are many existing processors to use.
ODBC Running reports on a separate Queries require knowing column and table names rather than labels.
Driver system Since ODBC queries return database values rather than display values, reports on
Integrating with existing reporting reference or choice fields will not be as useable.
tools Consider generating reports from theReporting engine or Performance Analyticsinstead.
Further challenges
Improve your skills by attempting these tasks on your own.
As a developer, you can use the API to perform the following actions.
To support the API, the ServiceNow platform provides these coding tools.
The database
The current record
The previous record
The full system API
Business Server Perform operations on table data when it is displayed, inserted, updated, deleted, Validate data and trigger events.
rules or queried. They are similar to RDBMS triggers but with a full server-side API to
support them.
Script Server Store JavaScript functions and classes for use by server-side script objects. Each Enable different components to reuse
includes script include defines either a function or an implementation of a ServiceNow server code and to make server code
class. Script includes only run when called by a server script. available to client-side calls.
Events Server Run when specific conditions occur on the system to trigger script actions. Identify and log when certain conditions
are met, such as when an incident is
opened or closed.
Script Server Run when a specific event is triggered to determine how the system handles it. Automate a response when a specific
actions event occurs, such as send an email
notification when an incident is opened.
UI actions Server Add buttons, links, and context menu items on forms and lists to allow users to Enable users to perform a specific action,
or perform application-specific operations. such as resolve an incident.
client
Client Client Run JavaScript on the browser to perform operations on form and list data. Enforce data policies during data entry,
scripts such as validate that an end date is after
a start date.
UI policies Client Perform operations on form data or fields, such as making fields mandatory, Enforce data policies from the UI, such as
visible, or read-only. make a field required on first entry and
then read-only afterwards.
Script
var cost = 0;
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of all equipment for this event
var equipment = new GlideRecord('x_snc_marketing_ev_equipment_request');
equipment.addQuery('marketing_event', mrkevent);
equipment.query();
while(equipment.next()){
cost = cost + parseFloat(equipment.cost.getCurrencyValue());
}
//Display cost and budget error
gs.addInfoMessage('The total cost of ' + evtname + ' is ' + cost + '.');
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
action.setRedirectURL(current);
4. Click Submit.
For more information about these classes, objects, and methods, see Scoped GlideRecord API Reference unless otherwise noted.
current An object that stores field values of the current record. See Glide Script Objects.
current.budget A dot-walking reference to a particular field of the current record. In this case, the values of
the Budget, Sys ID, andNamefields. SeeDot-walking.
current.sys_id
current.name
GlideRecord(‘x_snc_marketing_ev_equipment_request’) A class for database operations you can use instead of writing SQL queries. A GlideRecord
object contains records for a single table. In this case, the object contains records for the
Equipment Request table.
addQuery(‘marketing_event’, current.sys_id) A GlideRecord method to return records by specifying a query. In this case, the method adds a
filter to the current query, equivalent to an SQL WHERE clause, where the marketing event field
equals the system ID of the current record.
query() A GlideRecord method to run any queries added by previous method calls.
next() A GlideRecord method to determine if there is another record in the GlideRecord object.
parseFloat() A GlideSystem method to convert a currency value to a floating number. See Scripting Currency
and Price Fields.
getCurrencyValue() A GlideSystem method to convert a currency string to a numeric value for calculations.
SeeScripting Currency and Price Fields.
gs.addInfoMessage A GlideSystem method to display an information message on the top of the screen.
See Scoped GlideSystem API Reference.
action.setRedirectURL(current) A UI action method to redirect the user to another page. In this case, the system redirects the
client to the current record after updating it. See UI Actions.
The system displays both the total cost of the event and an error message that the budget has been exceeded.
Tell users when a marketing event exceeds its Yes Requires user to manually select action.
budget. Users can still create events that exceed their budget.
Display the total equipment cost of a marketing Yes Requires user to manually select action.
event. Would be better to always display current cost total.
Display the available remaining budget for a No Could update UI action to compute remaining budget from
marketing event. thebudget and costvariables and display it.
This information might be better stored in a separate field or determined by a list
calculation.
A UI policy is a good fit for this business logic because it offers full control over the order in which client-side operations take place. Use the Order field to
specify which UI policy you want to run first.
You can also use list filters to query for specific UI policies if you decide later to change their behavior.
Field Value
Field Value
Mandatory True
7. Click Submit.
8. Repeat steps 5 – 7 for the Sponsor and Budget fields.
9. Click Update.
Field Value
Budget $2000.00
City Sydney
4. Click Submit.
Figure 2. Mandatory fields warning message
The system displays a pop-up window with the message The following mandatory fields are not filled in: Sponsor.
5. Click OK.
6. In Sponsor, enter Sydney partners.
7. Click Submit.
A client script is a good API component to use for this validation effort because it runs before the client sends any data to the server. This prevents the server
from inserting or updating a marketing event containing bad data. It also prevents time-consuming queries to the server, which improves application
performance.
Field Value
Type onSubmit
Script
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('end_date') == '')
return;
4. Click Submit.
For more information about these classes, objects, and methods, see GlideForm (g_form) unless otherwise noted.
function onSubmit() A JavaScript function call that occurs whenever the user submits form data. Enclosing code in a function prevents the
system API from erroneously re-using variable values in different scopes. See Client Scripts.
g_form.getValue(‘end_date’) A JavaScript API call to the GlideForm class. In this case, to use the getValue() method to get the value of
theend_date andstart_date fields.
g_form.getValue(‘start_date’)
g_form.clearMessages() A JavaScript API call to the GlideForm class. In this case, to use the clearMessages() method to remove any previous
error and info messages.
g_form.getLabelOf(‘end_date’) A JavaScript API call to the GlideForm class. In this case, to use the getLabelOf() method to get the label of
theend_datefield.
Before After the user submits the form but before Validate data before inserting or updating
the system takes any action on the record in into the database.
the database.
After After the user submits the form and after the Perform calculations or business logic on
system takes action on the record on the data, such as updating totals or counts.
database.
Display Before the system displays the form to the Perform calculations or business logic on
user and just after the system reads a record data that may affect user input, such as the
from the database. current price of a catalog item.
Exercise 8: Create a before business rule
In this exercise you create a before business rule to validate the marketing event budget whenever a user inserts or updates a marketing request record. You
want to abort any insert or update where the marketing event budget is zero.
A before business rule is a good fit for this business logic because the system can validate all inserts and updates to the target table regardless of the input
method. Validation occurs whether a user submits a form, a user submits a service catalog record producer request, or there is an automated web services
request.
Field Value
Advanced Selected
When Before
Insert Selected
Update Selected
Script
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
var evtbudget = current.budget.getCurrencyValue();
if(evtbudget < 1){
gs.addErrorMessage('Budget must be greater than zero');
current.setAbortAction(true);
}
}
4. Click Submit.
function onBefore() A JavaScript function call that occurs after the user submits form data, but before any database operation. Enclosing code in
a function prevents the system API from erroneously re-using variable values in different scopes. See Business Rules.
current.setAbortAction(true) A GlideSystem method to abort the database operation on the current record. See Business Rules.
Exercise 9: Test the before business rule
In this exercise you test the before business rule to see if it validates all inserts and updates to the Marketing Events table regardless of source.
Field Value
City Sydney
4. Click Submit.
Figure 1. Testing the before business rule
The system displays two error messages: Invalid insert and Budget must be greater than zero.
Field Value
City Sydney
8. Click Submit.
Figure 2. Testing the before business rule with Service Catalog
The system displays an error message: Budget must be greater than zero.
An after business rule is a good fit for this business logic. You want to use the most current data to compute the total cost and you can compute that cost with
every insert and update.
Advanced Selected
When After
Insert Selected
Update Selected
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var cost = 0;
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of all equipment for this event
var equipment = new GlideRecord('x_snc_marketing_ev_equipment_request');
equipment.addQuery('marketing_event', mrkevent);
equipment.query();
while(equipment.next()){
cost = cost + parseFloat(equipment.cost.getCurrencyValue() );
}
gs.addInfoMessage('The total cost of ' + evtname + ' is ' + cost + '.');
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
}
4. Click Submit.
Field Value
Cost $800.00
5. Click Submit.
6. In Number of attendees expected, enter 10.
7. Click Update.
Figure 1. Test after business rule
The system displays an information message with the total cost of the marketing event, proof the after business rule ran.
Field Value
Type Banner
Cost $200.00
Tell users when a marketing event exceeds its Yes Automatically calculates cost and warns user of exceeding budget oninserts and
budget. updates.
Could create a display business rule to show the total cost when displaying a marketing
event.
Users can still create events that exceed their budget.
Display the total equipment cost of a marketing Yes Automatically calculates and displays cost on inserts and updates.
event. List control calculation removes need to add display business rule.
Could display this information in a separate field.
Display the available remaining budget for a No Could update business rule to compute remaining budget from
marketing event. the budget andcostvariables and display it.
This information might be better stored in a separate field.
A script include is a good fit if you want multiple API components to use the same server code.
Field Value
Name totalCost
Description Generate the total cost of a marketing event based on the equipment requests associated with it. Compare the total cost to the
event budget.
Script
var totalCost = Class.create();
totalCost.prototype = {
initialize: function(mrkevent) {
this.mrkevent = mrkevent;
},
getCost: function() {
var cost = 0;
//Get the total cost of all equipment for this event
var equipment = new GlideRecord('x_snc_marketing_ev_equipment_request');
equipment.addQuery('marketing_event', this.mrkevent);
equipment.query();
while(equipment.next()){
cost = cost + parseFloat(equipment.cost.getCurrencyValue());
}
return cost;
},
type: 'totalCost'
};
Protection Read-only
Policy
4. Click Submit.
Field Value
Script
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of equipment for this event
var equipment = new totalCost(mrkevent);
var cost = equipment.getCost();
gs.addInfoMessage('The total cost of ' + evtname + ' is ' + cost + '.');
//Compare cost to budget
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
action.setRedirectURL(current);
5. Click Update.
Field Value
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of equipment for this event
var equipment = new totalCost(mrkevent);
var cost = equipment.getCost();
gs.addInfoMessage('The total cost of ' + evtname + ' is ' + cost + '.');
//Compare cost to budget
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
}
5. Click Update.
Exercise 16: Test the updated after business rule
In this exercise you test your updated after business rule to verify that it calls the totalCost script include correctly.
Field Value
Budget $5000.00
City Sydney
Type AV
Cost $2000.00
7. Click Submit.
8. In Number of attendees expected, enter 50.
9. Click Update.
Figure 1. Test script include added to business rule
The system displays the total cost of the event.
initialize: function(budget, A function declaration that defines two parameters, budget andmrkevent.
mrkevent)
current.sys_id A dot-walking reference to the value of the Sys ID field of the current record. The Sys ID uniquely identifies the record like a
foreign key in a SQL query. See Dot-walking.
current.budget A dot-walking reference to the value of the budget field of the current record. See Dot-walking.
gs.addErrorMessage A GlideSystem method to display an error message on the top of the screen. See Scoped GlideSystem API Reference.
Field Value
Name event_cost
Read-only Selected
Field Value
Name budget_remaining
Read-only Selected
Field Value
Script
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of equipment for this event
var equipment = new totalCost(mrkevent);
var cost = equipment.getCost();
//Compare cost to budget
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
//Populate cost
current.event_cost = cost;
//Populate Budget remaining
var remaining = budget - cost;
current.budget_remaining = remaining;
current.update();
action.setRedirectURL(current);
5. Click Update.
Exercise 19: Update the after business rule for the data model addition
In this exercise you update the Show event cost UI action to populate the Budget remaining field and to remove the information message displaying the total
cost.
Field Value
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of equipment for this event
var equipment = new totalCost(mrkevent);
var cost = equipment.getCost();
//Compare cost to budget
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event budget.');
}
//Populate cost
current.event_cost = cost;
//Populate Budget remaining
var remaining = budget - cost;
current.budget_remaining = remaining;
current.update();
}
5. Click Update.
Field Value
6. Click Submit.
7. In Number of attendees expected, enter 50.
8. Right-click the form header and click Save.
Figure 2. Show event cost and Budget remaining fields after a new request
The system updates the values of the Event cost and Budget remaining fields.
Tell user when a marketing event exceeds its Yes Automatically calculates cost and warns user of exceeding budget on inserts, updates,
budget. andShow event cost UI action.
Could create a display business rule to show the total cost when displaying a marketing
event.
Budget remaining field always displays current information.
Users can still create events that exceed their budget.
Display the total equipment cost of a marketing Yes Automatically calculates and displays cost inserts, updates, and Show event cost UI
event. action.
Event cost field always displays current information.
Display the remaining budget available for a Yes Budget remaining field always displays current information.
marketing event. Changes in currency type do not change currency values.
Field Value
Name event_coordinator
Mandatory Selected
11. Drag the Sponsor field to the right column of the new section.
12. Click Number of attendees expected.
13. Rename the field to Max capacity.
14. Click Number of attendees registered.
15. Rename the field to Attendees registered.
16. Drag the Max capacity field underneath the Sponsor field.
17. Drag the Attendees registered field underneath the Event coordinator field.
Figure 1. Form design showing new section and fields
18. Click Save.
19. Close the Form Design tab.
20. Click the context menu next to Marketing Event – London LUG, and select Reload form.
Figure 2. Reloaded Marketing Events form with new section
The system displays the total cost of the event.
In a later exercise, you create an event that depends on the values of these mandatory fields.
A unique name that indicates what triggered the event, such as incident.commented.
A copy of the object that triggered the event, such as the current or previous GlideRecord object.
One or more parameters to help the event handler process the event, such as field values in the current record or the user name of the person who
changed the record that triggered the event.
An event queue name to help administrators find particular types of events, such astext_index.
Event handlers listen to the event queue to identify matching events. When an event handler recognizes an event, it runs code or generates a notification,
depending on its logic. After processing the event, the system updates the status of the event and keeps the results available in the event log.
As a developer, you can use the following workflow to create and process events.
Create an after business rule to insert one or more events into the event queue when particular database operations and conditions occur.
Register each event created in the business rule.
Create one or more event handlers.
Create a script action to run when the system identifies a matching event.
Create a notification to run when the system identifies a matching event.
Review the event log to verify the system is properly generating and processing events.
Using a business rule that runs after database operations ensures the system has the most current information available for event processing. Your code
checks for each type of database operation that can change record data and then creates appropriate events.
Field Value
Name Attendee Events
Advanced Selected
When After
Insert Selected
Update Selected
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
//Add event when attendee inserted
if(current.operation() == 'insert' && current.marketing_event.changes()) {
gs.eventQueue('x_snc_marketing_ev.attendee.added', current,
current.marketing_event, current.email);
}
//Add event when marketing event changes
if(current.operation() == 'update' && current.marketing_event.changes()) {
gs.eventQueue('x_snc_marketing_ev.attendee.deleted', previous,
previous.marketing_event, previous.email);
gs.eventQueue('x_snc_marketing_ev.attendee.added', current,
current.marketing_event, current.email);
}
//Add event when attendee deleted
if(current.operation() == 'delete') {
gs.eventQueue('x_snc_marketing_ev.attendee.deleted', current,
current.marketing_event, current.email);
4. Click Submit.
current.operation() A GlideRecord method that retrieves the current operation being performed, such as insert,
update, or delete. SeeGlideRecord.
current.marketing_event.changes() A GlideRecord method that indicates if an object changes value. In this case, the method
determines whether themarketing_event field changes value. See GlideRecord.
gs.eventQueue(‘x_snc_marketing_ev.attendee.added’, A GlideSystem method that adds an event to the event queue. In this case, the method adds
current, current.marketing_event, current.email) thex_snc_marketing_ev.attendee.addedevent, passes the current object (an Attendee record),
and passes the current value of the marketing_eventand email fields. See GlideSystem.
previous An object that stores field values of the previous record. See Glide Script Objects.
previous.marketing_event previous.email A dot-walking reference to a particular field value of the previous record. In this case, it accesses
the values of themarketing event and email fields. SeeDot-walking.
Exercise 24: Register attendee events
In this exercise you register the events from the Attendee Events business rule that you created.
Field Value
Suffix attendee.added
4. Click Submit.
5. Click New.
6. Enter the following values.
Field Value
Suffix attendee.deleted
Table Attendee [x_snc_marketing_ev_attendee]
7. Click Submit.
Field Value
Email alpha.beta@example.com
Field Value
Email charlie.delta@example.com
7. Click Submit.
8. Click charlie.delta@example.com.
9. Change the Marketing Event to Dallas LUG.
10. Click Update.
11. Click New.
12. Enter the following fields.
Field Value
Email echo.foxtrot@example.com
Marketing Event Dallas LUG
Figure 1. System events generated from the event creation business rule
The system displays a list of events.
The system displays the following error Your business rule uses an event name that is missing the application namespace prefix. Make sure the
message when testing your business rule. business rule uses the full event name including the application namespace prefix.
Access to event ‘event.name’ from scope For example, use the event namex_snc_marketing_ev_attendee.deleted rather than the event
‘Application Name’ has been refused. The nameattendee.deleted.
event is not defined.
The system displays the following error The system truncated the event name because it exceeded the maximum field length. By default, an event
message when testing your business rule. name can be a maximum of 40 characters long including the application namespace prefix. Make sure your
event name does not exceed the maximum length.
Access to event ‘prefix.event.name’ from
scope ‘Application Name’ has been For example, use the event namex_snc_marketing_ev_attendee.previous rather than the event
refused. The event is not defined. namex_snc_marketing_ev_attendee.marketing_event.previous.
Your events contain the wrong or outdated Verify the event business rule triggers after database operations.
information.
Exercise 26: Create Attendee script actions
In this exercise you create several script actions to automatically update the Attendees registeredfield of the affected marketing event.
Field Value
Order 100
Active Selected
Script
//Get marketing event from event
var mrkevent = new GlideRecord('x_snc_marketing_ev_marketing_event');
mrkevent.get(event.parm1);
//Count attendees for marketing event
var numOfAttendees = 0;
var attendees = new GlideAggregate('x_snc_marketing_ev_attendee');
attendees.addQuery('marketing_event', event.parm1);
attendees.addAggregate('COUNT');
attendees.query();
if(attendees.next())
numOfAttendees = attendees.getAggregate('COUNT');
//Set attendees registered field
mrkevent.number_of_attendees_registered = numOfAttendees;
mrkevent.update();
4. Click Submit.
5. Click New.
6. Enter the following field values.
Field Value
Order 100
Active Selected
Script
//Get marketing event from event
var mrkevent = new GlideRecord('x_snc_marketing_ev_marketing_event');
mrkevent.get(event.parm1);
//Count attendees for marketing event
var numOfAttendees = 0;
var attendees = new GlideAggregate('x_snc_marketing_ev_attendee');
attendees.addQuery('marketing_event', event.parm1);
attendees.addAggregate('COUNT');
attendees.query();
if(attendees.next())
numOfAttendees = attendees.getAggregate('COUNT');
//Set attendees registered field
mrkevent.number_of_attendees_registered = numOfAttendees;
mrkevent.update();
7. Click Submit.
get(event.parm1) A GlideRecord method that retrieves a particular record given a Sys ID value. In this case, the
event.param1 variable contains the Sys ID value. SeeGlideRecord.
GlideAggregate(‘x_snc_marketing_ev_attendee’) A class for performing database aggregation queries, such as COUNT, SUM, MIN, MAX, and AVG. In
this case, the system makes aggregation queries available for the Attendees table.
SeeGlideAggregate.
addAggregate(‘COUNT’) A GlideAggregate method to specify a database aggregation query. In this case, it is a COUNT
aggregation query. See GlideAggregate
getAggregate(‘COUNT’) A GlideAggregate method to retrieve the value of a database aggregation query. In this case, it is a
COUNT aggregation query. See GlideAggregate
update() A GlideRecord method that saves any changes you have made to a GlideRecord object.
See GlideRecord.
Rename Number of attendees registered to Attendees registered. Yes A field label on the form has a separate value from the
column name in the list.
The column name remains
number_of_attendees_registered.
Rename Number of attendees expected to Max capacity. Yes A field label has a separate value from the column name.
The column name remains
number_of_attendees_expected.
Add an event coordinator to each marketing event. Yes The reference field allows users to quickly select a value.
The event coordinator must always have a user record.
Count the number of attendees registered for each marketing event and Yes The script actions properly count marketing events
automatically populate the value on the form. during inserts, updates, and deletes.
Could make the Attendee field on the marketing event
form read-only.
03 Coding on ServiceNow - Module 9 - Events and notifications
An email message when the number of registered attendees is at the max capacity
An email message when the number of registered attendees is over capacity
A text message for each condition if email is unavailable
Earlier, you created the Attendee Events busines rule. It inserts an event whenever an attendee record is created, updated, or deleted.
Field Value
Advanced Selected
When After
Order 200
Insert Selected
Update Selected
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
//Add event when attendees reaches capacity
if(current.number_of_attendees_registered == current.number_of_attendees_expected) {
gs.eventQueue('x_snc_marketing_ev.at_capacity', current, current.sys_id,
current.event_coordinator);
}
//Add event when attendees exceeds capacity
if(current.number_of_attendees_registered > current.number_of_attendees_expected) {
gs.eventQueue('x_snc_marketing_ev.over_capacity', current, current.sys_id,
current.event_coordinator);
}
}
4. Click Submit.
Field Value
Suffix at_capacity
4. Click Submit.
5. Click New.
6. Enter the following values.
Field Value
Suffix over_capacity
7. Click Submit.
Exercise 30: Create email notifications
In this exercise you create email notifications to inform the event coordinator when a marketing event has reached or exceeded capacity.
Field Value
Name At capacity
Weight 10
Message HTML The marketing event ${URI_REF} has reached its attendee capacity of ${number_of_attendees_expected}.
Field Value
Weight 20
Message HTML The marketing event ${URI_REF} is over capacity with ${number_of_attendees_registered} registered attendees and a max
capacity of ${number_of_attendees_expected}.
8. Click Update.
Exercise 31: Test email notifications
In this exercise you test whether your events generate the expected email notifications.
Steps 1-9 bring the event to capacity and reveal the resulting message.
The subject of the first email message should be Marketing event Sydney LUG has reached capacity.
Note: The recipient’s email address was automatically populated from the Event Coordinator information associated with that marketing event.
8. Select the first email message.
9. Verify the Body field contains a link to a marketing event record and the capacity of the marketing event.
Figure 2. Body of at-capacity email message
Steps 10-16 place the marketing event over capacity and show the resulting message.
The subject of the first email message should be Marketing event Sydney LUG is over capacity.
Send the event coordinator an email message Yes The event coordinator gets emails when a
when the number of registered attendees is at marketing event reaches capacity.
the max capacity. Future enhancement: display an information
message whenever viewing a marketing
event record at capacity.
Send the event coordinator an email message Yes The event coordinator gets emails when a
when the number of registered attendees is over marketing event exceeds capacity.
capacity. Future enhancement: create a before
business rule to prevent inserts and updates
that exceed marketing event capacity.
Send the event coordinator text messages if Yes Each notification has an SMS alternative.
email is not available. Requires the event coordinator to set a
primary notification device: email or SMS.
JavaScript Debugger Set breakpoints Debug business rules and script includes.
See the call stack
See variable values
Edit code and save changes
JavaScript Log See the JavaScript log file Debug JavaScript that runs on the browser, such as
See transaction times client scripts.
Clear the contents of the log
Field Watcher See all actions the system performs on a field Determine how field values change while on a form.
See field values
See a dedicated log for a field
Scripts – Background Run freeform code on the server Run JavaScript and test output.
module Select the application scope
See output and log messages
Session Debug modules Separate modules for common components Determine what components affect a given record or
See log output in the Debug Output pane at the bottom of table.
every page
See which components run or are skipped
This business rule has a flaw in it that you uncover and fix during debugging later.
1. Navigate to System Definition > Business Rules.
2. Click the Updated colum to sort by the most recent updates.
3. Click Calculate total cost.
4. Clear the Active checkbox.
5. Click Update.
6. Enter the following field values.
Field Value
Advanced Selected
When After
Insert Selected
Update Selected
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var cost = 0;
var budget = current.budget;
var mrkevent = current.sys_id;
var evtname = current.name;
//Get the total cost of equipment for this event
var equipment = new GlideRecord("x_snc_marketing_ev_equipment_request");
equipment.addQuery("marketing_event", mrkevent);
equipment.query();
while(equipment.next()){
cost = cost + equipment.cost;
}
//Compare cost to budget
if(cost > budget){
gs.addErrorMessage('Equipment costs for ' + evtname + ' exceed the event
budget.');
}
//Populate cost
current.event_cost = cost;
//Populate Budget remaining
var remaining = budget - cost;
current.budget_remaining = remaining;
current.update();
}
7. Click Submit.
Important: This exercise works best with a Firefox browser. Some features, such as breakpoints, may not work with a Chrome browser.
In steps 1-10 you open the Debug total cost business rule in the JavaScript debugger and set four break points.
In steps 11-22 you update a Marketing Event. You then run the Debug total cost business rule through four breakpoints, observing the changes to variables and
field values at each break.
11. On the Marketing Event form, change the Max capacity to 12.
12. Right-click the form header and click Save.
The system runs the Debug total cost business rule until it reaches the first breakpoint at line 8.
13. From the right pane, click Variables.
14. Expand the Local section.
The JavaScript debugger displays the values of local variables.
The cost variable changed from 0 to 02000300. The calculation at line 12 does not properly generate the cost Update the calculation to use
of a marketing event. numeric values.
It should have changed to 2300.
It appears the calculation uses string values rather than
numeric values.
The budget_remaining andevent cost fields These values are derived from the calculation at line 12. Fixing the cost calculation should fix
display incorrect values. these values.
In steps 1-11, you edit a line of code in the debugger, update an event record in the application, and then advance to the first breakpoint in the debugger.
In steps 12-19, you make a different change to the same line of code, and then step through the breakpoints in the debugger to determine if your change fixed
the calculation error.
12. From the middle pane, change line 12 to cost = cost + parseFloat(equipment.cost);.
Figure 3. Change to line 12
13. From the middle pane, click Save.
14. From the left pane, click Go to advance to the next breakpoint at line 23.
15. Click Go again to advance to the next breakpoint at line 15.
16. Note the value of the cost variable changed to 2300.0
Figure 4. Breakpoint line 15
17. Click Go to advance to the next breakpoint at line 23.
18. Notice that the value of the budget_remaining field changed to -300 and the value of theevent_cost field changed to 2300.
Figure 5. Breakpoint line 23
19. From the left pane, click the Toggle debugger On | Off icon to stop debugging the business rule.
In steps 20-32, you return to the Marketing Event application, update both an equipment request and an event, and then step through the breakpoints in the
debugger to confirm that costs are still calculating correctly.
The cost calculation in the Debug total cost business rule generates the same The getCurrencyValue()method is not Remove the
results as the Calculate total costbusiness rule, but with less code. necessary in our business rule cost unnecessary
calculation. method call.
Script Reusing server code Functions are good candidates for script includes.
includes Allowing client access to server code There are many existing script includes to use.
Editing existing script includes may break existing functionality.
Events Taking action when certain database operations occur Events are not a good choice for schedule-driven conditions.
Communicating with other applications SeeScheduled Jobs instead.
Notifications do not require creating custom events. SeeEmail
Notifications.
Script actions Taking action when events occur Script actions are intended for event handling.
Adding business logic to records that do not directly allow Notifications do not use script actions.
coding
UI actions Allowing the user to take action on records UI actions are intended for optional actions.
Actions that require a user’s decision Require screen presentation in the user interface.
UI actions can run code from the server side, client side, or both.
Validating data before submitting it to the server Client scripts should not duplicate logic in UI policies.
Client scripts Reducing queries to the database Client scripts do not affect non-interactive input sources, such as
web services.
Use the GlideAjax class to improve performance of server-side
calls.
Client scripts do not run in a specific order.
UI policies Enforcing data integrity by making form elements read- UI policies can conflict with or overwrite client scripts logic. Avoid
only, required, or hidden duplication.
Quickly changing form elements without having to write UI policies do not affect non-interactive input sources, such as web
code for each element services.
UI policies apply only to fields on the form. Be sure to add
necessary fields to the form.
GlideRecord Getting data from tables Each GlideRecord query requires database access and resources.
Performing database operations on records Avoid complex queries of large data sets to prevent performance
issues.
There are many methods to use.
GlideSystem Getting information about the system Each GlideSystem query requires database access and resources.
Displaying information, warnings, and errors There are many methods to use.
Adding events into the event queue
GlideAggregate Performing calculations on records Each GlideAggregate query requires database access and
Server-side calculations resources.
There are many methods to use.
current Working on current record values Each table has its own current object.
Business rules Use GlideRecord to compare records in one table to another.
previous Working on previous record values Each table has its own previous object.
Business rules Use GlideRecord to compare records in one table to another.
Dot-walking Getting the value of specific fields Dot-walking requires a GlideRecord object.
Getting information from a related table through a Dot-walking requires knowing a table’s underlying dictionary
reference field schema.
g_form Working on field values before submitting them to the This class only applies to data on a user’s browser.
server This class no effect on non-interactive inserts and updates, such as
Enforcing data integrity from the UI web services.
Further challenges
Improve your skills by attempting these tasks on your own.
Create a record producer for the Attendees table to allow people to sign up for marketing events.
Create a field to track a marketing event’s status, such as New, Planning, and Complete.
Create a business rule to automatically set a marketing event’s status based on whether it has a budget, sponsor, and attendees.
Send an email notification to the event coordinator one week before a marketing event is scheduled to start.
Application Requirements
To help meet the needs of the event coordinators and all stakeholders for the event, build an application on the ServiceNow platform with the following
capabilities.
Marketing events manager Centralized location to manage all details of the event, including
required equipment, attendee lists, and attachments.
Ability to provide real-time status
5. Click Create and click OK to confirm that you want to create the application.
Figure 1. Confirm application
The Marketing Events Application is created and the Application Creation: Successwindow appears.
Note: When you create an application, the Application Creator creates a new role (called u_marketing_events_application_user) that you can assign to
users who need access to this application.
6. Click View app record.
The Marketing Events Application opens.
Figure 2. Marketing Events Application
You have a new application – but it doesn’t do anything yet. In the next exercise, you will start to make the application functional.
The sample application you will be building requires three database tables:
Marketing Event
Equipment request
Attendee
The Marketing Event table has a one-to-many relationship with the Equipment Request table and the Attendee table.
1. From the Marketing Events Application, scroll to the Tables section and click New.
2. Enter Marketing Event in the Label field.
The Name field populates automatically, based on the label and application name.
3. Create the columns for the table, using the following information.
1. From the Marketing Event Application, scroll to the Tables section and click New.
2. Enter Equipment Request in the Label field.
The Name field is filled in automatically, based on the label and application name.
Note: The Marketing Event field is a reference to the Marketing Event table. A reference field creates a relationship between two tables and allows you to
display information from another table. It is similar to the primary and foreign keys in a relational database. In this case, a particular piece of equipment is
related to a particular marketing event.
6. Click Submit.
You have created the second of the three required tables. The third table, Attendee, is created inExercise 7: Extending the data model.
1. Right-click the title bar of the Marketing Events form and select Configure > Form Design.
2. Drag and drop the items in the order you want them to appear.
3. Add city values.
1. Hover over the City field and click the gear icon.
2. In the Properties dialog box, click Create choices.
3. For Choice 1, 2, and 3, enter Dallas, Kansas City, and London.
4. Click in the empty row and create new entries for San Jose, Portland, andSydney.
5. Close the Properties dialog box.
4. Make the Name field mandatory.
1. Hover over the Name field and click the gear icon.
2. Select the Mandatory check box.
3. Close the Properties dialog box.
5. Click Save.
6. On the Marketing Event form, right-click the title bar, and select Reload form.
A form appears. You will customize the form in the next exercise.
1. Right-click the form header and select Configure > Form Design.
2. Drag and drop the items in the order you want them to appear.
3. Click Save.
04 Building a sample ServiceNow application - Exercise 4 - Adding event
records
1. Click New.
2. Populate the fields.
3. Click Submit.
3. Navigate to Marketing Events Application > Equipment Requests.
4. Click New.
5. Create event records containing the following information:
1. Click New.
2. Populate the fields.
3. Click Submit.
Create a report
Build a calendar report to display the upcoming marketing events in a calendar view.
Type Calendar
4. Click Run.
5. Click Save.
04 Building a sample ServiceNow application - Exercise 6 - Importing
data
Note: There is a close match to the columns in the CSV file and the column names in the Marketing Event table. You will import this data into the Marketing
Event table.
Import the data
Load the data from a spreadsheet into the marketing events table.
1. In the left navigation pane, navigate to System Import Sets > Load Data.
2. Select Create table.
3. Enter the following information.
Sheet number 1
Header row 1
4. Click Submit.
ServiceNow displays a success message after importing the file.
A transform takes data from the staging table, maps it according to the transform logic, and loads it into the target table.
1. To return to the Marketing Event table, click the gear icon in the upper right, scroll to the Application section and click the information icon (i).
2. Click the Marketing Event table.
3. Create the fields with the following information.
4. Click Submit.
5. Navigate to Marketing Events Application > Attendees.
6. Add a few attendees.
1. Click New.
2. Enter attendee information.
3. Click Submit.
Thank you!
4. Click Submit.
4. Click Submit.
Add a few test attendee records to test the email notification functionality. Navigate to System Mailboxes > Outbound > Sent to see the email
records ServiceNowgenerates. It may take 15-30 seconds for messages to show up. You may also want to check Outlook.
Service Catalog
Using the ServiceNow platform’s built-in Service Catalog ensures that users have a single interface for all of their request-based needs without having to
navigate multiple applications and interfaces.
The application you have built so far is a big hit with the marketing department. Spurred by that initial success, they want to expand the application to solve
other common issues they face.
Currently, requests to hold marketing events arrive via email to sales managers. These requests are often missing key information and are rarely handled
consistently. Marketing now want requestors to fill out an online form instead of using current inconsistent methods. The marketing department can then
receive, review, and track the requests online, and process them more consistently and efficiently.
There are two ways that you can implement these changes:
In this exercise, you will create a service catalog item for the application.
A record producer creates an input form within the Service Catalog to capture requests and then uses the request data to create a new record in a destination
table. For our purposes, we want a record producer that creates new records in the Event Marketing table when someone uses the Service Catalog to request a
new event.
What it will contain > Description Please fill out the details to request a marketing event in your region. The
marketing team will review your request and get back to you.
4. Click Submit.
Typically, enterprises using ServiceNow have separate environments (or instances) to support development, test, and production. This ensures production
users are insulated from changes before they are thoroughly tested.
5. Click Publish.
ServiceNow creates a package with all the artifacts related to our application.
6. Click Done.
7. Under Related Links, click Export to XML and save the file to your computer.
Option Description
If there are Examine each error in the Update Set Preview Problems list, and accept or skip the update responsible for it.
errors
Note: You can decide row by row, using the Available Actions column, or you can select multiple rows and make a group decision
via the Actions on selected rows… choice list.
Build a workflow
Build a workflow for approving and rejecting requests.
Business processes are often implemented by a combination of e-mail, conversations, and other inefficient, manual methods. Workflows can automate this,
resulting in increased efficiency and reduced errors. Additionally, workflows provide an audit trail, which can be critical for an application that has to comply with
internal or external regulations.
In this sample scenario, the marketing VP has to approve the request for any equipment that costs over $500. As soon as a user enters request for an
equipment costing over $500, the workflow you create is triggered. This is a very simple, but common, scenario. The platform workflow capabilities allow
complex criteria for triggering, approvals, branching as well as integration with external systems.
3. Enter the following information, leaving the rest of the fields with default values.
4. Click Submit.
An empty workflow appears. On the right is the palette of tasks and other activities that you can add to the workflow.
5. Click the Core tab and expand the Approvals folder, then drag the Approval-User activity between Begin and End.
6. Enter the name Get VIP Approval.
The New Activity: Approval – User form appears.
7. Click the Users lock icon and search for a user (for example, Fred Luddy).
Note: You can send the request to a particular person (for example, Fred Luddy) or group (for example, Procurement).
8. Click Submit.
The workflow is updated.
9. Create a point on the workflow for Set Status to Requested.
1. In the Utilities folder, navigate to Set Values.
2. Drag and drop Set Values between Begin and Approval – User.
The New Activity: Set Values window appears.
3. Enter the name Set Status to Requested.
4. Select Approval from the –choose field– choice list and Requested from the –None–choicelist.
5. Click Submit.
The workflow is updated.
10. Create a point on the workflow for Set Approval to Approved.
1. Drag and drop Set Values between Approved – User and End.
2. Enter the name Set Approval to Approved.
3. Select Approval from the –choose field– choice list and Approved from the –None–choice list.
4. Click Submit.
The workflow is updated.
11. Create a point on the workflow for Set Approval to Rejected.
1. Drag and drop Set Values between Approval – User Rejected and End.
2. Enter the name Set Approval to Rejected.
3. Select Approval from the –choose field– choice list and Rejected from the –None–choicelist.
4. Click Submit.
The workflow is updated and the Set Values node for Set Approval to Rejected is added to the workflow but it is not connected to Approval –
User and End.
12. Connect the Set Values node for Set Approval to Rejected.
1. Click Rejected in the Approval – User node and draw the line to the Set Values node for Set Approval to Rejected.
2. Click Always in the Set Values node for Set Approval to Rejected and draw the line toEnd.
You can track the status of the workflow in a field on the record itself by using the Approval field from the task table. The equipment table extends task so you
have access to all the fields in the task table. This field can have four possible values:
Publish a workflow
In this exercise you will publish the workflow you created to make it accessible to users.
1. Click the hamburger icon in the title bar and select Publish.
2. Click OK.
The status at the top shows Published.
3. Add an Approval field to the Equipment Request table list and form.
Note: Refer to Lab 3 if you have forgotten how to configure list and form views.
4. Test the approval process.
1. Enter an equipment request for more than $500.
2. Select Requested for the Approval value.
3. Click Submit.
Approve a workflow request
Approve a workflow request using the system administrator role.
1. Navigate to My Approvals.
The list view of all approval requests appears.
2. Click the Requested link for the recently submitted request.
3. Approve the request.
Note: In this example you can change the approval field status directly. In a real-world scenario, you may want to make this field read-only for the user who
submits the request.
The state changes on the next screen. The state is also reflected in the equipment list view.
Security basics
The ServiceNow platform provides a variety of administrative controls and a fine-grained application security model to secure your applications.
The diagram below depicts one way to think about the security of the applications and some of the platform capabilities provided to address it. At the bottom are
the controls that are mandated by your company’s security policies. On top of that may be industry-specific requirements and best practices. These two layers
may be common across multiple applications. Finally, there is application-specific security that controls access to individual application.
The platform security capabilities should not be looked at in isolation, but should be used together to secure the application. Though in this tutorial we have
deferred security to a later chapter, as a best practice you should understand the security requirements for your applications and incorporate them into the early
stages of the implementation cycle.
A role is a category that can be assigned to a user, and can be granted access to particular parts of the system – in this case, the marketing event application.
When you used the application creator in exercise 1, it created a new role, called u_marketing_events_application_user) that you can assign to users who need
access to this application. By defining a role, you give visibility to the application only to users in that role. However, you may want to further restrict what a
particular role or user is allowed to do.
Access control lists are one of the mechanisms provided to restrict access at a fine level of granularity.
1. Impersonate a user (Beth Anglin) who doesn’t have the u_marketing_events_application_user role and verify that the Marketing Event Application isn’t
visible.
1. Click the Impersonate icon.
2. Search for Beth Anglin and click OK.
When access is through a mobile device, the screens are automatically reformatted to make your application more mobile-friendly. Below is a non-mobile-
specific view:
Field Value
For Apple iPad users, the ServiceNow platform delivers an iPad-specific view. The UI on the iPad looks and feels more like a native application than just
browser-based access. The platform recognizes it if you access an application from an iPad and automatically sends an iPad-specific view. The figure below
shows the iPad view of the Marketing Event form.
Most real-world business scenarios involve some form of ad-hoc conversation and problem solving with various stakeholders. In the case of event management
application, it may be finding a person to cover an event, sharing some insight with the team, or other related tasks. This is typically done outside of the
application via email.
The problem with this approach is that context is lost. Having the conversation inside the application means greater immediacy and contextual relevance. If, for
example, the conversation is around a specific event in a specific location, the conversation can focus on the relevant record.
The ServiceNow Service Automation Platform is designed to help you build your application declaratively (with mouse clicks) instead of writing code. However,
there may be instances where the declarative features are not sufficient. In such cases, you can use JavaScript code to create business rules. Almost
all ServiceNow platform capabilities (including workflow, security, UI, and database) can be customized with a business rule.
In this exercise, you will look at one of the more common scenarios that can benefit from custom code, in conjunction with a database operation like insert,
update or delete. Business rules can be made to execute before or after a database operation. If you are familiar with relational database triggers, you will
notice that business rules are similar to triggers in relational databases.
Note: The business rule you are creating in this exercise is a very simple rule for illustrative purposes. Code written for the real world can be as complex as you
wish.
Field Value
Active Selected
Advanced Selected
Insert Selected
When After
Script
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var gr = new GlideRecord('x_snc_marketing_ev_marketing_event');
gr.get(current.marketing_event);
gr.number_of_attendees_registered += 1;
gr.update();
}
4. Click Update.
5. Test by adding a few attendees.
The current registration count should reflect the addition.
The common elements and functionality of UIs automatically generated by the ServiceNowService application make it easy to use and navigate, which
increases user adoption and satisfaction. This is the recommended way to build UI.
However, there may be situations where you may want to have a different look and feel for your application, perhaps to match corporate standards. You can
accomplish this on the platform by writing a UI Page based on Jelly, an open standard from the Apache Software Foundation.
Note: UI Pages also allow you to incorporate your own stylesheets (CSS) as well as Javascript libraries. For a customer example, look
athttps://it.byu.edu/byu/default.do
1. Navigate to UI Pages.
2. Click New.
3. Enter the name AttendeeForm (no space).
4. Copy the following code into the HTML field.
<style type=”text/css”>
body{
font-family:”Lucida Grande”, “Lucida Sans Unicode”, Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0;
margin:0; padding:0;}
.spacer{clear:both;
height:1px;}
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:400px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #b7ddf2;
background:#ebf4fb;
}
#stylized h1{
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px
#b7ddf2;
padding-bottom:10px;
}
#stylized label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #aacfe4;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666
url(img/button.png) norepeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}
</style>
<div id=”stylized” class=”myform”>
<g:ui_form id=”form” name=”form”>
<h1>Sign-up form</h1>
<p>Please sign up here for an fun and informative session</p>
<label>First Name<span class=”small”>First Name</span>
</label>
<input type=”text” name=”fname” id=”name” />
<label>Last Name<span class=”small”>Last Name</span>
</label>
<input type=”text” name=”lname” id=”name” />
<label>Email<span class=”small”>Add a valid address</span>
</label>
<input type=”text” name=”email” id=”email” />
<label>Phone<span class=”small”>Your Phone Number</span>
</label>
<input type=”text” name=”phone” id=”phone” />
<button type=”submit”>Sign-up</button>
<div class=”spacer”></div>
</g:ui_form>
</div>
5. Copy the following Javascript in the Processing script field.
6. Substitute the placeholder sys_id with an actual sys_id. To obtain this open a record, right-click the grey bar and select Copy sys_id.
7. Go to the bottom of the page and click Update.
8. Access the page by going to http://<instance_name>.service-now.com/AttendeeForm.do.
Note: Replace <instance_name> with your instance name.
9. Add a new attendee to test that everything is working as expected.
Until now, a single development instance was all you needed to create and update an application. You need at least one more to deploy your application.
1. Log in to HI.
2. From the Self-Service > Clone an instance page in HI, submit a clone request.
3. [Optional] Repeat step 2 and request two more cloned instances.
Note:
Request the additional clones if you have multiple developers working on the same application simultaneously.
Request the additional clones if you have a hierarchichal development environment that includes development, test, beta, production, or other tiers.
If neither of these situations apply to your organization, order only one clone and skip module 3.
Business requirements
In previous training, you created and enhanced a Marketing Events application. Now you need to distribute it to other instances for testing.
Transfer the application from your development instance to your test instance.
Include demo data with the application.
Back up the application to an external file.
Feature Description
Specify the update set The system stores application changes in a matching update set. For example, the system stores the Marketing Events
where the system stores Application in the Marketing Events Application update set.
changes.
You can create a new update set to store application changes. SeeApplication Files.
Export an update set as You can manually export an update set as an XML file.
an XML file.
Identify differences The system automatically identifies application files from an incoming update that match existing application files on the local
between update sets system. Administrators have the option to select the version they want by choosing to keep the local version or to apply the
incoming remote version.
Merge update sets If you store changes in multiple update sets, you can merge them to create a new update set that combines the application files
from both update sets.
Merging update sets ensures that the system applies changes in the proper order.
5. Navigate to these Marketing Event tables and create a similar set of application files for each table.
Table
Equipment Requests
Attendees
Sales Prospects
Field Value
Version 1.0
Short description Manage marketing events by tracking budgets, equipment requests, and attendees. Includes REST web service.
4. Click Update.
The applications list displays the updated details.
Figure 1. Updated Applications list
Consider this exercise optional if you cannot access a second instance and proceed to the next lesson.
1. Log in as an administrator to the target instance where you want to apply the update set.
2. Navigate to System Update Sets > Update Sources.
3. Click New.
4. Enter these field values.
Field Value
Name Development
Type Development
9. From the Retrieved Update Sets related list, click Marketing Events Application.
The system displays the update set record.
10. Click Preview Update Set.
The system compares the application files in the update set to the application files on the local system.
If this instance has never installed the Marketing Events application, there should be no errors. If this instance has an earlier version of the application, the
system displays a list of update set conflicts.
11. Resolve any update set conflicts by selecting the option to Accept remote update.
12. Click Commit Update Set.
The system displays the Marketing Events application in the application navigator and in the list of Applications.
Transfer the application from your Yes Requires manually creating an update set to transfer.
development instance to your test The preview process identifies conflicts with existing records.
instance. Can resolve conflicts by selecting the version to apply.
Include demo data in the application. Yes Requires manually selecting records to include as application files.
Can select when to install demo data.
Back up the application to an external Yes Requires manually creating an update set to export to a file.
file. File only contains a fixed version of the application.
Capturing future updates requires regenerating the file.
Application users need to know when there are application updates to install.
Application developers need to control when application updates appear to application users.
Application developers need to identify the latest application version.
You meet these business needs by publishing an application to the ServiceNow application repository.
Requirement Description
Valid subscription The instance must be registered to a company with a valid subscription.
Personal developers instances do not have a subscription and cannot connect to the application
repository.
Matching application scope The application repository can share applications only with instances belonging to the same
application scope. All of the applications must belong to the subscriber’s application scope.
Network access The instance must be able to reach the application repository on the network. If you enable IP
access restrictions, allow connections from the application repository.
Exercise 6: Publish an application to the repository
Make your application available to all instances that belong to the same company by publishing it to the ServiceNow repository.
Treat this exercise as optional if you were unable to acquire an instance earlier.
Note: The target instance must belong to the same company as the instance in the previous exercise. A personal development instance will not work here.
Field Value
Auto-number Selected
Prefix ATTEND
Number 1,000
Number of digits 7
The system uploads the updated version of the application to the application repository. It is now the current version ready for other instances to download.
Exercise 10: Update the test instance
Update the Marketing Events application on the test instance with the current version on the development instance. This exercise assumes you installed the
application on the test instance previously.
Treat this exercise as optional if you were unable to acquire an instance earlier.
Application users need to know when Yes The Update option is available only when developers publish an
there are application updates to install. update.
Developers can provide release notes for each update.
Application developers want to control Yes The Update option is available only when developers publish an
when application updates appear to update.
application users. Use the version value and development notes to bundle changes
in a single update.
Application developers need to identify Yes The Downloads tab lists the most current application version only.
the latest application version. The Updates tab lists the most current update only.
05 Deploying applications - Module 3 - [Optional] Team development
Parent An instance that becomes the central repository for all changes. Can be a Identify differences between instances.
instance production or a test instance. Pull changes from an instance below it in the
hierarchy.
Push changes to an instance below it in the
hierarchy.
Development A sub-production instance managed by one or more developers. Create new applications and features.
instance Replicate the production environment.
Avoid causing outages on a production instance.
Test instance A sub-production instance where new applications and features are tested. Test all new applications and features on a sub-
Typically this is a parent instance to the development instances. production instance.
Replicate the production environment.
Avoid causing outages on a production instance.
Peer or A sub-production instance that shares a parent instance with other sub- Provide individual developers or teams with their
sibling production instances. own instance.
instance Allow divisions of labor such as new application
development and patch development.
Reconcile An action that identifies the differences between two instances. Identify changes between a parent and a
development instance.
Identify changes between peer instances.
Push An action that copies changes from a development instance to a parent instance. Bring a parent instance up to date with the latest
Always requires a reconciliation. changes.
Identify which local changes to ignore.
Pull An action that copies changes from the parent instance to a development Bring a development instance up to date with the
instance. Always requires a reconciliation. latest changes.
Identify change collisions.
Queue for An action that identifies which local changes to push to the parent instance Identify local changes to push to the parent
push instance.
Allow developers to push completed changes
and continue work.
Ignore An action that prevents a local change from being part of a push action. Stop tracking local versions for particular files.
Allow developers to control what changes
appear in the change list.
Collision An incoming change that conflicts with a local change. Select which change to accept.
Select which change to archive.
Note: The parent instance should not be the instance where you installed the application from the application repository. Best practice is not to mix these two
means of deployment on the same instance. Use team development is to make applications and move them to other instances for testing. Use the application
repository to deploy completed applications
Field Value
Name Parent
Type Development
URL <Click lock icon to access field, then enter URL to parent instance>
Keep the In the Actions choice list, select Use Pulled Version. This is commonly used the first time you pull to make sure your development
parent version instance reflects what exists before beginning application development.
Keep the local In the Actions choice list, select Use Local Version. This is commonly used when you have modified the record as part of
version developing the application.
When complete, the team dashboard should display OK for both the parent and local instance.
Field Value
Name Vendor
Reference Company
The system updates the existing application files in the Marketing Events Application.
Field Value
Name Vendors
5. Click Close.
The Team Dashboard no longer displays a Ready to Push row.
Figure 2. Team Dashboard with nothing to push
Field Value
Name Parent
Type Development
URL <Click lock icon to access field, then enter URL to parent instance>
Note: Conflicts often exist between the records pulled and those already on the instance. When they do, a Collisions button appears
12. If visible, click Collisions.
The system displays a list of change collisions for you to resolve by choosing which version of each file to keep.
13. Select the check boxes for the collision records to resolve.
14. Click the checkbox next to Actions on selected rows…
15. Resolve the selected colisions by performing one of these actions.
Option Description
Keep the In the Actions choice list, select Use Pulled Version. This is commonly used the first time you pull. It ensures that your development
parent instance mirors what exists on the parent instance before beginning application development.
version
Keep the In the Actions choice list, select Use Local Version. This is commonly used when you have modified the record as part of developing
local version the application.
Field Value
Field Value
The steps for queueing changes and pushing them to the parent instance are the same as they were in the previous exercise. However, the update to the
application is different. It conflicts with the change queued from the initial development instance.
Field Value
Allow configuration Selected
5. Click Update.
6. Navigate to Team Development > Team Dashboard.
7. From Local Changes, filter the list to show changes to the Marketing Events application.
8. Click the checkbox to select all rows.
9. From Actions on selected rows, select Queue for Push.
The Team Dashboard displays a Ready to Push row.
10. From the Team Dashboard, click Push.
The system displays the Push Changes form.
Field Value
4. Click Update.
5. Navigate to Team Development > Team Dashboard.
6. From Local Changes, filter the list to show changes to the Marketing Events application.
7. Click the checkbox to select all rows.
8. From Actions on selected rows, select Queue for Push.
9. From the Team Dashboard, click Collisions.
The system displays a list of collisions.
Figure 1. Collision of push and pull versions
Field Value
Multiple developers can work on the Yes There are a number of possible parent-child instance
same applications simultaneously. configurations to choose from.
Team development identifies collisions between instances, not
between individual developers on the same instance.
You must decide how many development instances are best for
your environment.
Developers can retrieve changes from a Yes Developers can pull changes from the parent instance.
central instance. Pulling frequently identifies collisions sooner.
Collisions must be resolved before changes can be pulled from the
parent.
Developers can send changes to a Yes Developers can identify and push local changes to the parent
central instance. instance.
Developers can ignore local changes they do not wish to push to
the parent instance.
There is a mechanism to identify and Yes Developers can see the differences between the local and
resolve change conflicts. incoming changes.
To prevent overwriting incoming changes, developers must
manually merge incoming changes on their local instance.
05 Deploying applications - Module 4 - Considerations and conclusions
Update Sets Storing changes to a baseline or installed You can manually create update sets to
application store a particular application version.
Storing and applying a particular version of Use update sets to deploy patches or
an application changes to installed applications.
Producing a file for export Avoid using update sets to install
applications. Instead, use the application
repository or theServiceNow Store to install
applications.
Application Repository Installing and updating applications on all of Consider uploading an application to
your instances the ServiceNow Store to share it with other
Automatically managing application update users.
sets Allows installation of and update to the latest
Restricting access to applications to the application version only. Use update sets to
same company store prior application versions.
Deploying completed applications to end If used in conjunction with team
users development, make applications available
only from a parent instance.
Team Development Providing change management across Works best when each development team
multiple instances has access to a dedicated development
Allowing multiple developers to work on instance.
applications Requires developers to manually merge
Organizations that have access to several colliding changes.
sub-production instances If used in conjunction with the application
repository, make applications available from
a parent instance.
Only works for instances owned by the same
company.
Further challenges
Improve your skills by attempting these tasks on your own.
1. Click the Employee Self-Service bookmark you created in the previous exercise.
Note: The site record for the Employee Self-Service window is the parent record for all of the content pages within the site. The site record form contains
reference fields to other values, such as site layout, site theme (CSS file), and the Portal page. The Portal page is the first page displayed when a user
navigates to the portal URL. At the bottom of the form is a Related Links list that includes all the pages that exist within that particular site. Because many
or all pages can use a single content section, you only need to modify the content section once.
2. Click the icon next to Portal in the Home page field.
Figure 1. Home page field icon
The Page – Portal form displays. This form contains fields such as Layout (if different from Site Layout) and Content Theme. If there is no value in
the Layout orContent Themefields, they inherit those values from the parent site record.
3. Click the Edit Page link.
Figure 2. Edit Page link
The Portal page displays. This page contains a collection of content blocks that you can add, remove, and edit.
There are three colored bars: a light-gray top row, a white row behind the logo and banner text, and a red row behind the main menu. Alternatively, the
Background option lets you choose a background image. For this exercise, leave Background as Colored Bars.
Figure 3. Background
5. Download the CloudDimensionsLogo.png file from http://tinyurl.com/cms101-logo or use the logo of your choice.
6. On the header form link in the Logo field, click Update.
7. Click Browse, navigate to the CloudDimensionsLogo.png file that you downloaded, and click OK.
The header record form appears with the new logo in the place of the ServiceNow logo. The new logo has a solid blue background.
8. Modify the value for middle and bottom color bars, leaving the Top color bar value unchanged.
The current value for the Top color bar is the hexadecimal value for light blue.
Note: For the top, middle, and bottom bar colors, you can use standard color names such as red, blue, and yellow or the hexidecimal values of colors. To
find the hexadecimal value of a specific image, use an image editor or a browser plugin such as ColorZilla.
1. Enter the value #1F5FA0 into the Middle bar color field to match the blue color in the logo image.
2. Replace the Bottom color bar value (currently the current hexidecimal value for red) with the word gray.
9. Enter Self Service Portal in the Text field.
10. Click Update.
11. Navigate to http://<yourinstance>.service-now.com/ess.
The screen should look like the following:
Figure 4. Self Service Portal
06 Content Management System 101 - Module 2 - New content pages
from existing
The easiest way to create a new page is to use another page as a template, copy it, then make changes to the copy.
1. Click the Employee Self-Service bookmark to open the site record.
2. Scroll to the Pages section and click Portal – Order Hardware.
You will use the Portal – Order Hardware page as a template for the Schedule Relocation page. The Portal – Order Hardware page is designed for a user
to order something.
Figure 1. Portal – Order Hardware
3. Click Copy.
Note: Content on pages are related records. Those functions do not copy related records, so you cannot use the Insert or Insert and Stay commands to
copy a page.
Figure 2. Copy
The Copy of Portal – Order Hardware page appears. The Name and URL suffix fields contain a copy of the information from the Portal – Order
Hardware page.
4. Replace the information in the Name field with Scheduled Relocation and the information in the URL suffix field with scheduled_relocation.
5. Scroll to the Related Links section and click Edit Page.
6. Click the X icon to remove Portal – Order Splash Menu from the page.
7. Click the Add Content link.
Figure 3. Add Content link
8. In the Sections box, select Content Blocks and New Detail, click Add Here, and click the X icon to close the Sections box.
Figure 4. Sections box
9. Click the Close icon to remove the Portal – Nav Column Common and Portal – Content Column Common content blocks.
These content blocks are used for advanced prototyping on the site.
Note: If you want to keep these content blocks, move Portal – Content Column Commonbefore the New Detail content block.
10. Click the Edit icon ( ) to edit the New Detail content block.
The Detailed Content page appears. This screen specifies the details of the new record.
Figure 5. Detailed Content page
11. In the Name field, enter Portal - Scheduled Relocation.
12. From the Type drop-down menu, select Show a specific document.
13. Click the magnifying glass next to the Model document field.
The Select the document window appears.
14. From the Table name drop-down menu, select Catalog Item.
15. Click the magnifying glass next to the Document field.
16. Filter the Catalog Items by typing scheduled in the Search box and pressing Enter.
17. Click Schedule Relocation.
The Select the document window looks similar to the following:
Figure 6. Select the document window
18. Click OK.
The Detailed Content page looks similar to the following:
Figure 7. Detailed Content page
19. Click Submit.
The Scheduled Relocation page looks similar to the following:
Figure 8. Scheduled Relocation page
20. Click the preview link to see how the page appears to the end user.
The page looks similar to the following:
Figure 9. End user view
21. Close the preview window.
Field Value
Order 500
7. Click Submit.
8. Navigate to http://<yourinstance>.service-now.com/ess.
The Get Help portal menu should look like the following:
Figure 3. Get Help portal menu
Order 500
8. Click Submit.
9. Navigate to http://<yourinstance>.service-now.com/ess.
The Get Help drop-down in the bottom menu of the header should look like the following:
Figure 1. Get Help drop-down in the bottom menu of the header
06 Content Management System 101 - Module 3 - New content pages
from scratch
The header appears on the page in the background and the Sections box is still available. Use this box to add multiple items to the page.
8. In the Sections box, keep Content Blocks selected and select My Requests.
A preview of the My Requests section appears.
9. Click the second Add Here section.
Figure 3. Add Here
10. Repeat steps 8 and 9, selecting Top Requests in the Sections box instead of My Requests.
11. In the Sections box, keep Content Blocks selected and select *New Detail.
A preview of the *New Detail section appears.
12. Click the third Add Here section.
Figure 4. Add Here
13. Click the X icon ( ) in the top-right of the Sections box.
The portal looks similar to the following.
Figure 5. Portal example
16. Click the magnifying glass next to the Model document field.
17. From the Table name drop-down menu, select Category.
18. Click the magnifying glass next to the Document field and select Can We Help You.
19. Click OK.
20. Click Submit.
21. Click the preview link to see how the page appears to the end user.
The page looks similar to the following:
Figure 6. End user view
Exercise 7: Add the page to the portal menu
Add the Can We Help You page as a link in the Order Things portal menu.
This is the same process you followed when you made the Schedule Relocation page available in an earlier module.
1. Click the Portal bookmark in the Edge.
2. Scroll to the Related Links section and click Edit Page.
Field Value
7. Click Submit.
8. Navigate to http://<yourinstance>.service-now.com/ess.
The Order Things portal menu should look like the following:
Figure 2. Order Things portal menu
3. Click Chat.
Figure 2. Click Chat
7. In the XML section, scroll to the lines that start with <td id dropzone20″ and <td id dropzone10″.
Figure 4. Locate XML lines
8. Swap these two lines of XML.
Figure 5. Swap XML lines
9. Right‐click the record’s gray bar and select Insert and Stay.
Figure 6. Select Insert and Stay
Rebrand a portal homepage Yes Browsing for and selecting the logo of your choice is
simple and easy.
A logo approximately 80px high preserves the bulk of the
screen for content.
You can select an image for the banner’s background, or
use colored bars.
If you use bars, specify the colors with standard names like
red and blue, or with hexidecimal values.
Create new pages Yes The most common way is to use an existing page as a
template, copy it, then make changes to the copy.
You can also create pages from scratch.
Make new pages available Yes Linking the new page directly from the portal homepage is
a simple process.
You can also easily link the new page to an item in one of
the header drop-down menus, if desired.
Use the preview link to see how the page appears to the
end user.
Activate system plugins Yes The platform’s chat plugin added sophisticated
functionality to your application in moments.
See List of plugins for names, IDs, and descriptions of over
500 available plugins.
Further challenges
Improve your skills by attempting these tasks on your own.
Add your logo and company colors to the self-service portal banner.
Change some text in the banner.
Rearrange the order of the items in one of the banner pull-down menus.
Activate the password reset plugin for self-service and service desk password resets.