Level Up Your ServiceNow Skills: A Beginnerâs Guide to Building Custom Apps (No Code Required!)
So, youâre ready to dive into the exciting world of ServiceNow application development? Fantastic! You might be thinking, âBut I donât know how to code!â Donât worry! ServiceNowâs low-code/no-code platform allows you to build powerful custom applications without writing a single line of Javascript (initially!). This guide will walk you through the basics, equipping you with the knowledge to create your first custom application.
What are Custom Applications and Why Build Them?
Think of ServiceNow as a Lego set. The out-of-the-box functionalities (like Incident Management, Change Management, etc.) are pre-built models. Custom applications allow you to create your own unique creations using those existing âLego bricks,â or create entirely new ones tailored to your specific business needs.
Hereâs why building custom apps is beneficial:
- Automate Unique Processes: Address workflows and processes that arenât covered by standard ServiceNow modules.
- Improve Efficiency: Streamline tasks and reduce manual effort.
- Enhance User Experience: Create intuitive interfaces that cater to your usersâ specific needs.
- Increase Innovation: Empower your team to experiment and develop solutions that drive business value.
The Foundation: Understanding ServiceNow Building Blocks
Before we start building, letâs familiarize ourselves with the core concepts:
- Tables: Tables are the fundamental data structures in ServiceNow, similar to spreadsheets or database tables. They store information about specific entities (e.g., incidents, users, assets). Each row represents a record, and each column represents a field.
- Fields: Fields are the individual data elements within a table (e.g., Incident Number, Short Description, Priority). They define the type of information stored in each column.
- Forms: Forms are the user interfaces for creating, viewing, and editing records in a table. They display the fields and allow users to interact with the data.
- Lists: Lists are a way to view multiple records from a table in a structured format.
- Modules: Modules are the navigation links in the ServiceNow interface that allow users to access specific tables, forms, or reports.
- Application Scope: This defines the boundaries of your application. It helps prevent naming conflicts and ensures that your application doesnât interfere with other ServiceNow functionalities.
- Roles: These control access to applications and functionalities. You can define roles to restrict access to certain tables, forms, or modules.
Step-by-Step Guide: Building a Simple âEmployee Onboardingâ Application
Letâs create a simple application to manage the employee onboarding process. This app will track new hires and their onboarding tasks.
Step 1: Create a New Application
- In the ServiceNow interface, type âStudioâ in the filter navigator and select System Applications > Studio.
- Click on âCreate Applicationâ.
- Enter the following details:
- Name: Employee Onboarding
- Description: Tracks and manages the employee onboarding process.
- Click âCreateâ. The Studio will open with your new application.
- If prompted, select âStart from scratchâ
Step 2: Create the âNew Hireâ Table
- In the Studio, click on âCreate Application Fileâ.
- Select Data Model > Table and click âCreateâ.
- Enter the following details:
- Label: New Hire
- Name: u_new_hire (This will be automatically generated based on the label. The âu_â prefix indicates a custom table.)
- Extends table: Task (Extending the Task table provides useful fields like State, Assignment Group, Assigned To, etc.)
- Click âSubmitâ.
- Now, you need to define the fields for your table. Add these fields:
- Field Label: First Name
- Column Name: u_first_name (Automatically generated)
- Type: String
- Max Length: 100
- Field Label: Last Name
- Column Name: u_last_name
- Type: String
- Max Length: 100
- Field Label: Start Date
- Column Name: u_start_date
- Type: Date
- Field Label: Department
- Column Name: u_department
- Type: String
- Max Length: 100
- Field Label: Job Title
- Column Name: u_job_title
- Type: String
- Max Length: 100
- Field Label: First Name
Step 3: Customize the Form Layout
- In the Studio, navigate to the âNew Hireâ table you just created.
- In the table configuration, click on the âConfigureâ related link.
- Then select âForm Layoutâ.
- Move the fields you created (First Name, Last Name, Start Date, Department, Job Title) to the âSelectedâ column.
- You can also rearrange the order of the fields as desired.
- Click âSaveâ. This will update the form layout for the âNew Hireâ table.
Step 4: Create Modules for Easy Access
-
In the Studio, click on âCreate Application Fileâ.
-
Select Navigation > Module and click âCreateâ.
-
Create a module to create new New Hire records:
- Title: Create New Hire
- Application Menu: Employee Onboarding
- Order: 100
- Link Type: New Record
- Table: New Hire (u_new_hire)
-
Create a module to view the list of New Hire records:
- Title: All New Hires
- Application Menu: Employee Onboarding
- Order: 200
- Link Type: List of Records
- Table: New Hire (u_new_hire)
Step 5: Testing Your Application
- In the ServiceNow interface, navigate to the âEmployee Onboardingâ application using the application navigator. You should see the modules you created (âCreate New Hireâ and âAll New Hiresâ).
- Click on âCreate New Hireâ and fill out the form with test data. Click âSubmitâ.
- Click on âAll New Hiresâ to verify that the new record appears in the list.
Step 6: Adding a Business Rule (A Touch of âLow-Codeâ)
Letâs add a simple business rule to automatically set the âStateâ field to âPending Onboardingâ when a new âNew Hireâ record is created.
-
In the Studio, click on âCreate Application Fileâ.
-
Select Automation > Business Rule and click âCreateâ.
-
Enter the following details:
- Name: Set New Hire State to Pending
- Table: New Hire (u_new_hire)
- When to Run:
- When: Before
- Insert: Checked
- Advanced: Checked
-
In the âAdvancedâ tab, paste the following code into the âScriptâ field:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.state = '1'; // '1' usually represents 'Pending Onboarding' - check your State field choices.
})(current, previous);
- Click âSubmitâ.
Explanation of the Code:
current
represents the current record being processed (the âNew Hireâ record in this case).current.state = '1';
sets the âStateâ field to the value â1â, which corresponds to âPending Onboardingâ. Youâll need to check the choices available for your âStateâ field and use the appropriate value.
Now, when you create a new âNew Hireâ record, the âStateâ field will automatically be set to âPending Onboarding.â
Key Considerations for Application Development:
- Planning is Key: Before you start building, clearly define the problem youâre trying to solve and the requirements for your application.
- Security: Always consider security implications when designing your application. Use roles and access controls to restrict access to sensitive data.
- User Experience: Design an intuitive and user-friendly interface.
- Testing: Thoroughly test your application before deploying it to production.
- Application Scoping: Understand the impact of application scoping and how it affects development.
- Version Control: Use source control (e.g., Git) to manage your code and track changes.
Conclusion
Congratulations! Youâve taken your first steps into the world of ServiceNow application development. Youâve learned how to create a custom application, design a table, customize a form, add modules, and even implemented a simple business rule. Remember to start with small, manageable projects and gradually increase the complexity as you gain experience. The possibilities are endless! Explore the ServiceNow documentation, experiment with different features, and join the ServiceNow community to learn from other developers. Happy building!