Event Management Application
Event Management Application
ServiceNow enables you to create applications quickly, with little to no coding required. This
tutorial walks you through building an event management application for a fictitious company.
The event coordinators at the fictitious company manage events with spreadsheets, email, phone
calls, and Google Docs. Coordinators struggle with managing equipment, attendee lists, and
attendee notifications.
Application Requirements
To help meet the needs of the company, build an app that will meet the following criteria for each
stakeholder.
Users who have completed the Developer Platform Introduction training will have already created
this application and associated tables, and can continue to Exercise 4: Adding event records.
5. Click Create and then OK to confirm that you want to create the application.
Figure 1. Confirm application
The system creates the Marketing Events Application and displays a Application Creation
Success window.
Note: When you create an application, the Application Creator creates a new role that you can
assign to users to grant access to the application.
You have built your application, but it does not do anything yet. In the next exercise you will build the
foundation necessary to make your app functional.
Required tables
ServiceNow is built on a relational database that contains tables, which contain records, the
records hold fields, and each field is a column.
You can extend an existing table or create brand new tables for your application. This decision is
one of the most important decisions you will make when building applications. For our sample
app, you will create brand new tables. This will allow you to script and configure all of the
behaviors of your application.
Marketing Event
Equipment request
Attendee
The Marketing Event table will have a one-to-many relationship with the Equipment Request
and the Attendee tables.
The Name field populates automatically, based on the label and application name.
Note: When you set Display to true for Name, the system displays the text of this field to
identify records in this table. In this case, whenever you need to select a particular
Marketing Event record, you will see the value from the Name field instead of the system-
generated 32-character long sys ID.
You can navigate to your new table by performing any of the following options.
Create the additional columns for the Task table by building them one row at a time, using the
following information.
Column label Type Reference Display
Type String true
Cost Currency false
Needed from Date false
Needed until Date false
Marketing event Reference Marketing Event false
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.
a. Click New.
b. Populate the fields.
c. Click Submit.
4. Navigate to Marketing Events Application > Equipment Requests.
5. Click New.
6. Create the following sample equipment request records:
a. Click New.
b. Populate the fields.
c. Click Submit.
Associate events with equipment requests
Configure related lists so that you can see events and equipment requests on the same page.
4. From the Available list, double-click the Equipment Request > Marketing Event list.
You can also add the Attachments related list. This is a built-in functionality that allows you to add a
file, document, or image to a record.
5. Click Save.
The system displays a blank Marketing Event form.
6. Fill in the Marketing event form with sample values.
7. Right-click the form header and click Save.
The Equipments Requests related list appears at the bottom of the form.
You will see equipment requests for existing events and for new events as they are submitted.
Creating reports and dashboards
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.
Importing data
Create a CSV file for import
Create a comma-separated values (CSV) file with event information, which you can use to import
data into the database.
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.
The system 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.
2. Fill in the Table Transform Map with the following information and right-click the form header and
click Save.
7. Verify that any incoming dates are in a format the system recognizes.
a. From the Fields Maps list, click u_start_date.
b. If the default date format does not match the date format in the CSV source file, click
the light bulb icon to select a new date format.
c. Select the yyyy-MM-dd format to match the date format in the CSV file and
click Update.
8. Verify that any end dates are in a format the system recognizes.
a. From the Fields Maps related list, click u_end_date
b. If the default date format does not match the date format in the CSV source file, click
the light bulb icon to select a new date format.
c. Select the yyyy-MM-dd format to match the date format in the CSV file and
click Update.
9. In the Related Links list, click Transform.
The system displays the import set and transform map to be used in the transform.
10. Click Transform.
The system takes data from the temporary staging table and uses the transformation logic to insert
new records in to the marketing event table.
Extending the data model
Add fields to the Marketing Event table
Add fields to the Marketing Event table so you can capture the number of attendees expected and
the number of attendees registered.
Users who have completed the Developer platform introduction training will have already created
these fields.
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. From the Tables related list, click the Marketing Event table.
The system displays the Table record for Marketing Event.
3. Create these fields with the following information.
5. From the Controls section, accept the default values for the Create access controls and User
role fields.
6. Click Submit.
The system creates the new table and displays the Custom Application record for the Marketing
Events Application.
7. From the Application Navigator, click Navigator options > Refresh Navigator.
The system reloads all menus and modules.
Thank you!
4. Click Submit.
Create an email notification
Create an email notification to send a confirmation email to users when they register for your event.
Who will receive > Users/Groups in fields Add the Email field to Selected column
5. Click Submit.
Add a few test attendee records to test the email notification functionality. Navigate to System
Mailboxes > Outbound >Outbox to see the email records ServiceNow generates. It may take 15-
30 seconds for messages to show up. You may also want to check the other Outbound queues such
as Sent and Skipped to verify the message was generated.
Note: By default, email is disabled on development instances.
Using the service catalog
Service Catalog
Using the ServiceNow platform’s built-in Service Catalog ensures that users have a single interface
for all of their requests without having to navigate multiple applications.
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.
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 email. The marketing department can then receive, review,
track requests online, and process them more 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 whenever someone uses the
Service Catalog to request a new marketing event.
What it will contain > Short description Request for a Marketing 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. Note: Your Marketing Event table name will list your instance's unique application scope prefix
for the Marketing Event Application such as x_0123_marketing_e_.
5.
6. Click Submit.
The system creates the new record and displays it in the list of Record Producers.
3. Note: For each variable, we have intentionally set the value of the Name field to match the
name of a corresponding column in the Marketing Event table. This mapping allows the system
to automatically save data entered into the variable into the matching field in the Marketing
Event table.
4.
Field Value
10. Note: Currently there are no restrictions on the data users can enter in this record producer.
This could result in errors such as city names that do not appear in the choice list and currency
values that include string values for the denomination such as $ for USD, £ for GBP, or ¥ for
JPY.
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.
Field Value to use
4.
5. Click Submit.
An empty workflow appears. On the right is the palette of tasks and other activities that you can add
to the workflow.
6. Click the Core tab and expand the Approvals folder, then drag the Approval-User activity
between Begin and End.
The New Activity: Approval - User form appears.
7. Enter the name Get VIP Approval.
8. 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).
9. Click Submit.
The workflow is updated.
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:
Not Yet Requested
Requested
Approved
Rejected
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. Configure the list and form to add the Approval field.
Note: Refer to Lab 3 if you have forgotten how to configure list and form views.
4. Test the workflow approval process by creating a new Equipment Request record.
a. Navigate to Marketing Events > New Equipment Requests.
The system opens a blank Equipment Request from.
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.
Securing the application
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 applications.
The platform security capabilities should not be looked at in isolation, but should be used together to
secure the application. 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 planning, design, development and implementation.
A role is a collection of permissions used to grant access to applications and other parts of the
system and to assign security controls. When you used the application creator in exercise 1, it
created a new role (x_scopeID_marketing_ev_user) that you can assign to users who need access
to the application.
An Access control list restricts access at a fine level of granularity by uniquely identifying an object
and providing a list of conditions that must be met to access the object.
Note: The system also uses a unique five-digit number to prefix all of your application components.
This number distinguishes your application from other applications developed by other users.
Field Value
g. Click Save.
The system displays the group record.
3. Add Beth as a member of the Marketing Events group.
a. From the Group Members related list, click Edit.
The system displays the Edit Group Members form.
b. From the list of available users, double-click Beth Anglin to add her to group members list.
c. Click Save.
The system displays the group record.
4. Impersonate Beth again. Verify that the application is visible.
Writing business rules
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.
5. Click Submit.
6. Test by adding a few attendees.
The current registration count should reflect the addition.
UI actions
1. From the Banner frame, click the gear icon and scroll down to the Application picker. Verify
the Marketing Events Application you created in prior training is selected.
5. Note: In this and all other code samples you will need to update the table name to use the
actual application scope of your instance. This requires
replacing x_snc_marketing_ev_ with the actual application scope.
6. Note: Wherever possible, script samples use the Immediately Invoked Function Expression
(IIFE) format to conform to coding best practices.
7. Click Submit.
Test the UI action
In this exercise you test the UI action to see how it meets the business requirements of the
marketing event users.
a. Click New.
b. Populate the fields.
c. Click Submit.
3. Navigate to Marketing Events Application > New Equipment Requests.
4. Create the following sample equipment request records:
a. Click New.
b. Populate the fields.
c. Click Submit.
5. Navigate to Marketing Event > Marketing Events.
6. Click Dallas LUG.
7. Click Show event cost.
The system displays the total cost of the event.
8. From the Equipment Requests related list, select AV.
The system opens the related Equipment Request record
9. Change the Cost from $1,000.00 to $2,000.00.
10. Click Update.
The system displays the parent Marketing Event record.
11. Click Show event cost.
Figure 1. Show event cost
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 Yes Requires user to manually select action.
event exceeds its budget. Users can still create events that exceed their budget.
Display the total equipment Yes Requires user to manually select action.
cost of a marketing event. Would be better to always display current cost total.
Table 1. UI action to marketing requirements comparison
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.
Note: The system runs client scripts first, then UI policies.
You can also use list filters to query for specific UI policies if you decide later to change their
behavior.
The Name, Sponsor, and Budget fields have the mandatory field indicator on them.
3. Enter the following field values.
Field Value
Name Sydney LUG
Budget $2000.00
Start Date 2016-07-09
End Date 2016-07-11
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.
Client scripts
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.
4. Note: The getMessage() API call allows you to display a translated version of an onscreen
message, error, or warning on systems that support multiple languages. For more information
about translating an instance, see the product documentation.
5. Click Submit.
Business rules
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.
4. Click Submit.
4. Click Submit.
Script includes
A script include is a good fit if you want multiple API components to use the same server code.
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.
5. Click Update.
5. Click Update
5. Click Update.
5. Click Update.
Exercise: Create a new Service Catalog
In order to meet the needs of our Marketing Events department, you will create a new service
catalog for the Marketing Events team and populate the catalog using the record producer you
created in the Building a Sample ServiceNow application.
You will need to have completed Exercise 9 of the Building a Sample ServiceNow application.
This catalog will contain the Events Requests form that you created with the record producer. By
creating a new catalog your customer's will have a quick and easy way to submit their request.
2. Click New.
Field Description
Description Catalog for requesting goods and services from the Marketing Event Team.
Field Description
Active checked
4. Click Submit.
5. Open the Marketing Events catalog you just created.
6. Click or scroll to Categories.
7. Click New to create a new category.
5. Use the slush bucket to add the Marketing Events Catalog, then click Save.
6. Next select the Categories tab, then click New.
Field Description
Active checked
8. Click Submit.
9. You will now need to update the record producer using the table below:
For each variable select Map to Field.
Map each variable to the field specified in the table.
Field Value
City City
10. Click Update, your variables table should look like this.
Exercise: Add your new catalog to the Catalog
homepage
Add your new catalog to the homepage to allow users easy access to it.
A window opens that will allow you to position your new Marketing Events Catalog widget and
decide what that widget should show.
3. Click the left most Add here button, then click the ⊗ in the uper right corner.
4. Your screen should look like this.
In many business process definitions, approvals are requested before work can be performed.
However, approvals can also be requested as work is progressing. In the event that subsequent
approvals are rejected or tests or tasks fail, the Workflow Editor offers the Rollback To activity. This
activity allows the process designer to return to an earlier place in the workflow and restart it. The
Rollback To activity will adjust the state of User Approvals and Tasks that are part of a rolled back
set of activities. Before you can begin, you will need to have completed Exercise 11 of Building a
Sampl ServiceNow Application.
1. Navigate to System Security > Groups.
2. Search for the Catalog Request Approvers > $1000 group.
3. Modify the form with the following information.
Option Action
Name Equipment Request Approvers > $500
DescriptionThis is a group of users that need to approve an equipment request that is greater
than $500.
4. Click the Group Members tab.
5. Click Edit.
6. Use the slush bucket to add Fred Luddy to the group.
7. Click Save.
8. Next click Update.
The Equipment Request Approvers group is now viewable in the Group list.
1. In the Core Activities list on the Core tab, expand the Approvals folder and locate the Approval-
Group activity.
2. Drag Approval-Group onto the transition line between the Set Status to Requested set values
activity and the Get VIP Approval activity.
3. Fill in the fields on the form, as appropriate.
Field Description
9. Create a new transition line from Equipment Request Approvers Rejected to Set Approval to
Rejected.
10. Your workflow should look similar to this example.
Exercise: Add Rollback To activity
Use the Rollback To activity to change the state of the request back to Requested.
Our workflow is now set to automatically approve all equipment requests less than $500 dollars.
Anything over that amount will be assigned to the Equipment Requests Approvers group for
approval. In the event that a member of the group rejects the request, we are going to add a
Rollback To activity to change the state of the request back to Requested.
Field Description
4. Click Submit.
5. Drag the transition line from Equipment Request Approvers Rejectedto Approvals Rolled Back.
6. Drag the transition line from Approvals Rolled Back Always to Set Approval to Rejected.
7. Drag another transition line from Approvals Rolled Back Always to Set Status to Requested.
8. Your workflow should look like this.
9. Select the Workflow Actions menu then click Publish.
7. You should see the state go from Rejected to Not Yet Requested due to the Rollback To activity.
Notice that the state for the 2nd approver did not change.
The Related lists will be used to verify your Create Task activity later on in the lab.
4. From the Available lists select Approvers and Task > Parent, use the arrows to add them to the
Selected list.
5. Click Save.
6. Complete the form to create a new Equipment Request, then click Submit.
Set the cost to greater than 500 dollars in order to trigger your workflow.
7. Locate your new equipment request from the list and open it. You will see the related lists now
appear at the bottom of the form.
Exercise: Add the Create Task activity
Create a task that will be assigned to the System Administrator.
A gauge is a graphic image on a homepage that when clicked will link to the list of the records
specific to that piece of the graph. After you have saved your report you can make it a gauge and
add it to your homepage.
5. Select the dropdown arrow next to the Save button and click on Make gauge..
6. Select the dropdown arrow again and click on Add to Homepage. Select the drop zone you wish to
add it to by clicking Add here.
7. Next navigate to Self Service > Homepage and you will see your new report.
Exercise: Create a scheduled job
Scheduled jobs are automated pieces of work that can be performed at a particular time or on a
recurring schedule.
Schedule the Marketing Events Budget by City report to run weekly and be sent to theEquipment
Request Approversgroup.