Unlock ServiceNow Secrets: Build a Custom App From Scratch (Even if You’re a Beginner)
So, you’re diving into the world of ServiceNow and want to build your own custom application? Awesome! It might seem daunting at first, but with a little guidance, you’ll be building your own solutions in no time. This guide will walk you through the process, step-by-step, even if you’re a complete beginner.
What is a ServiceNow Application?
Think of a ServiceNow application as a self-contained package of functionality. It can include things like:
- Tables: Where you store your data (like spreadsheets).
- Forms: The interface for users to interact with the data in your tables.
- Workflows: Automated processes that trigger actions based on events.
- Business Rules: Logic that enforces data integrity and automates tasks.
- Client Scripts: JavaScript code that runs on the user’s browser to enhance the user experience.
- Script Includes: Reusable server-side scripts.
- UI Policies: Dynamic controls that modify the behavior and appearance of forms based on conditions.
- Modules: Navigation links that provide access to the application’s functionality.
In essence, it’s a mini-program within the ServiceNow ecosystem designed to solve a specific business problem.
Prerequisites
- A ServiceNow Instance: You’ll need access to a ServiceNow instance (developer instance is ideal and free). Sign up for a free developer instance at developer.servicenow.com .
- Basic Computer Literacy: Familiarity with using a computer and web browser.
- A Desire to Learn! Don’t be afraid to experiment and make mistakes – that’s how you learn!
Step 1: Planning Your Application
Before diving into ServiceNow, take some time to plan your application. What problem are you trying to solve? What data will you need to store? What will the user interface look like?
For this tutorial, let’s build a simple “Idea Tracker” application. This application will allow users to submit ideas, and track their progress.
Here’s the plan:
- Goal: To provide a centralized place to collect and manage employee ideas.
- Data:
- Idea Title (String)
- Idea Description (String)
- Submitted By (Reference to User table)
- Submission Date (Date/Time)
- Category (Choice List - e.g., “Product Improvement”, “Process Optimization”, “Customer Service”)
- Status (Choice List - e.g., “New”, “Under Review”, “Implemented”, “Rejected”)
- Comments (Journal Field - Allows for threaded comments/discussions)
- User Interface: A form for submitting new ideas, and a list view to see all submitted ideas.
Step 2: Creating the Application
- Navigate to Studio: In your ServiceNow instance, type “Studio” in the navigation filter and select “System Applications > Studio”.
- Create a New Application: Click the “Create Application” button.
- Application Details:
- Name: Enter “Idea Tracker”
- Description: Enter a brief description (e.g., “An application for tracking employee ideas”).
- Scope: ServiceNow will automatically generate a unique scope name. This is important for isolating your application. Make note of it (e.g.,
x_mycompany_idea_tracker
).
- Click “Create”. Studio will open with your newly created application.
Step 3: Creating the Table
The table is where you’ll store the data for your application.
- Create New Table: In Studio, click “Create Application File”.
- Select Table: Choose “Data Model” > “Table” and click “Create”.
- Table Details:
- Label: Enter “Idea” (This will be the user-friendly name).
- Name: ServiceNow will automatically generate a table name (e.g.,
x_mycompany_idea_tracker_idea
). This is the technical name. - Extends table: Leave this as “[None]” (we’re creating a brand new table).
- Create Module: Check this box. This will automatically create a module (navigation link) for your table.
- Click “Submit”.
Step 4: Adding Fields to the Table
Now, let’s add the fields we planned in Step 1 to the “Idea” table.
-
Open the Table: In Studio, find your “Idea” table under “Data Model”.
-
Add Fields: In the “Columns” related list, click “New”.
-
Create the “Idea Title” Field:
- Type: String
- Column label: Idea Title
- Column name: (ServiceNow will automatically generate this)
- Max length: 255 (adjust as needed)
- Mandatory: (Leave unchecked for now)
- Click “Submit”.
-
Repeat for the remaining fields:
- Idea Description:
- Type: String (or String (text))
- Column label: Idea Description
- Column name: (Auto-generated)
- Submitted By:
- Type: Reference
- Column label: Submitted By
- Column name: (Auto-generated)
- Reference table: User (
sys_user
)
- Submission Date:
- Type: Date/Time
- Column label: Submission Date
- Column name: (Auto-generated)
- Category:
- Type: Choice List
- Column label: Category
- Column name: (Auto-generated)
- Choices: Add the following choices with their corresponding values (the values can be short alphanumeric strings):
- Product Improvement (product)
- Process Optimization (process)
- Customer Service (customer)
- Status:
- Type: Choice List
- Column label: Status
- Column name: (Auto-generated)
- Choices:
- New (new)
- Under Review (review)
- Implemented (implemented)
- Rejected (rejected)
- Comments:
- Type: Journal
- Column label: Comments
- Column name: (Auto-generated)
- Idea Description:
Step 5: Configuring the Form Layout
The form layout determines how the fields are displayed on the form.
-
Open the Form Designer: While still in the “Idea” table in Studio, find and click the “Form Designer” related link (or right-click on the header and select “Configure > Form Designer”).
-
Customize the Layout: Drag and drop fields from the “Field Navigator” on the left onto the form layout on the right. Arrange them in a logical order. You can also create sections to group related fields. A good layout might be:
- Section: Idea Details
- Idea Title
- Idea Description
- Category
- Section: Submission Information
- Submitted By
- Submission Date
- Section: Status
- Status
- Comments
- Section: Idea Details
-
Save the Layout: Click “Save” in the Form Designer.
Step 6: Test Your Application
- Navigate to the Module: In the main ServiceNow navigation filter, type “Idea Tracker” (the name of your application). You should see a module (link) with the name of your table (e.g., “Ideas”).
- Create a New Record: Click the module. This will open the list view for your “Idea” table. Click “New” to create a new idea record.
- Fill out the Form: Enter data into the fields on the form.
- Save the Record: Click “Submit”.
- Verify the Record: Verify that the record appears in the list view. Open the record to ensure the data is correct.
Step 7: Adding a Business Rule (Optional)
Let’s add a simple business rule to automatically set the “Submission Date” when a new record is created.
- Create New Business Rule: In Studio, click “Create Application File”.
- Select Business Rule: Choose “Server Development” > “Business Rule” and click “Create”.
- Business Rule Details:
- Name: Set Submission Date
- Table: Idea (
x_mycompany_idea_tracker_idea
) - When to Run:
- When: Before
- Insert: Checked
- Update: Unchecked
- Advanced: Check this box to show the “Advanced” tab.
- Advanced Script: In the “Advanced” tab, paste the following script:
(function executeRule(current, previous /*null when async*/) {
current.submission_date = gs.nowDateTime();
})(current, previous);
- Save the Business Rule: Click “Submit”.
Explanation:
current
: Represents the current record being created or updated.submission_date
: The name of the “Submission Date” field.gs.nowDateTime()
: A ServiceNow function that returns the current date and time.
Now, when you create a new “Idea” record, the “Submission Date” will automatically be set to the current date and time.
Step 8: Customizing the List View (Optional)
You might want to customize which columns are displayed in the list view.
- Open the List View: Navigate to the “Ideas” module in the main ServiceNow interface.
- Configure List Layout: Right-click on any column header and select “Configure > List Layout”.
- Move Columns: Use the slushbucket (the two-section list) to move fields from the “Available” list to the “Selected” list. The “Selected” list determines which columns are displayed, and the order they appear in.
- Save the Layout: Click “Save”.
Conclusion
Congratulations! You’ve built a basic custom application in ServiceNow. You’ve learned how to:
- Create a new application.
- Create a table to store data.
- Add fields to the table.
- Configure the form layout.
- Create a basic business rule.
- Customize the list view.
This is just the beginning. ServiceNow offers a vast array of features and capabilities. Keep experimenting, keep learning, and you’ll be able to build powerful solutions to meet your business needs. Explore Client Scripts, UI Policies, Workflows, and more! Good luck on your ServiceNow journey!