Unlock ServiceNow Superpowers: Your Step-by-Step Guide to Building Custom Applications
ServiceNow is far more than just an IT service management (ITSM) platform. It’s a powerful application development platform (PaaS) that allows you to build custom applications tailored to your specific business needs. This means you can automate processes, streamline workflows, and ultimately, boost productivity across your entire organization. This guide is designed for beginners, walking you through the fundamental concepts and practical steps to build your first ServiceNow application.
Why Build Custom Applications in ServiceNow?
Before we dive in, let’s understand the benefits:
- Tailored Solutions: Address unique business requirements that off-the-shelf solutions can’t handle.
- Process Automation: Automate repetitive tasks, reducing manual effort and errors.
- Improved Efficiency: Streamline workflows and accelerate decision-making.
- Centralized Data: Consolidate data from different sources into a single, accessible platform.
- Enhanced User Experience: Create intuitive interfaces that users will actually want to use.
Understanding the Building Blocks
ServiceNow applications are built using several key components:
- Tables: The foundation of your application. Tables store data, similar to database tables. Think of them as spreadsheets where each row is a record and each column is a field.
- Fields: Individual data elements within a table (e.g., Name, Description, Status, Priority). Fields define the type of data you can store (text, date, number, etc.).
- Forms: User interfaces that allow users to view and interact with records in a table. Forms display fields and provide controls for editing data.
- Lists: Display a collection of records from a table in a tabular format. Lists provide a quick overview of the data and allow users to filter, sort, and search records.
- Modules: Navigation elements that provide access to the application’s forms, lists, and other features. Modules are grouped into applications.
- Workflows: Automate processes by defining a sequence of activities that are triggered by specific events.
- Business Rules: Server-side scripts that execute when records are created, updated, or deleted. They enforce data integrity and automate tasks.
- Client Scripts: Client-side scripts that run in the user’s browser and can modify the user interface, validate data, and interact with the server.
Step-by-Step Guide: Building a Simple “Employee Onboarding” Application
Let’s build a simple application to manage the employee onboarding process.
1. Create a New Application:
- Log in to your ServiceNow instance as an administrator.
- Navigate to System Applications > Application Management > Create Application.
- Fill in the Application form:
- Name: Employee Onboarding
- Description: Manages the employee onboarding process.
- Scope: (Leave as Global if you are not familiar with Scoped Applications, but for production ideally you’d create a scoped app.)
- Click Create. The platform will redirect you to the App Engine Studio interface or Studio based on your instance configuration.
2. Create a Table:
- In App Engine Studio or Studio, navigate to the data model section (might be labelled Data or Tables).
- Click “Create new” or ”+ New Table”.
- Fill in the Table form:
- Label: Onboarding Task
- Name: u_onboarding_task (The “u_” prefix indicates a custom table.)
- Extends table: Task (Inherit functionality from the Task table.)
- Check the boxes for “Create module” and “Create mobile module”.
- Click Save.
3. Add Fields to the Table:
- Within the table configuration, navigate to the Columns tab.
- Add the following fields:
- Field Label: Employee Name
- Column name: u_employee_name
- Type: String
- Field Label: Department
- Column name: u_department
- Type: Reference
- Reference table: cmn_department
- Field Label: Start Date
- Column name: u_start_date
- Type: Date
- Field Label: Onboarding Checklist
- Column name: u_onboarding_checklist
- Type: Multi-line Text
- Field Label: Assigned To (Inherited from the Task table)
- Field Label: State (Inherited from the Task table)
- Field Label: Priority (Inherited from the Task table)
- Field Label: Employee Name
- Click Save.
4. Customize the Form Layout:
- Navigate to Form Layout (usually found under the related links or table configuration).
- Add the newly created fields to the form.
- Arrange the fields in a logical order. For example:
- Employee Name
- Department
- Start Date
- Priority
- Assigned To
- State
- Onboarding Checklist
- Click Save.
5. Customize the List View:
- Navigate to List Layout (usually found under related links or table configuration).
- Select the fields you want to display in the list view. Good choices include:
- Number (the unique identifier for the record)
- Employee Name
- Department
- Start Date
- Assigned To
- State
- Priority
- Click Save.
6. Test Your Application:
- In the Application Navigator (the left-hand menu), search for “Employee Onboarding”. You should see the application menu with a module named “Onboarding Tasks”.
- Click “Onboarding Tasks”. This will open the list view.
- Click “New” to create a new onboarding task.
- Fill in the form with sample data and click “Submit”.
- Verify that the new record appears in the list view.
7. Enhance with Business Rules (Optional):
Let’s automatically set the State to “Pending” when a new Onboarding Task is created.
- Navigate to System Definition > Business Rules.
- Click New.
- Fill in the Business Rule form:
- Name: Set Onboarding Task State to Pending
- Table: Onboarding Task [u_onboarding_task]
- When to run:
- When: before
- Insert: Checked
- Advanced: Checked
- Script:
(function executeRule(current, previous /*null when async*/) {
current.state = 1; // 1 represents the "Pending" state
current.update();
})(current, previous);
- Click Submit.
8. Enhance with Client Scripts (Optional):
Let’s create a client script to display an alert when the Start Date is in the past.
- Navigate to System Definition > Client Scripts.
- Click New.
- Fill in the Client Script form:
- Name: Validate Start Date
- Table: Onboarding Task [u_onboarding_task]
- Type: onChange
- Field name: u_start_date
- UI Type: All
- Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var startDate = new Date(newValue);
var today = new Date();
if (startDate < today) {
alert('Start Date cannot be in the past.');
g_form.setValue('u_start_date', ''); // Clear the field
}
}
- Click Submit.
Conclusion
Congratulations! You’ve successfully built your first custom application in ServiceNow. This guide covered the fundamental concepts of tables, fields, forms, lists, modules, business rules, and client scripts. You learned how to create a simple application to manage employee onboarding tasks. Remember to experiment with different configurations and features to expand your knowledge and build more complex and powerful applications. This is just the beginning of your journey to unlocking ServiceNow’s full potential!