From Zero to Custom App Hero: A Practical Guide to Building in ServiceNow
ServiceNow is renowned as a powerful platform for streamlining IT service management (ITSM) processes. However, its true potential extends far beyond ITSM. ServiceNowâs application development capabilities allow you to build custom applications tailored to your specific business needs, automating workflows, improving efficiency, and gaining a competitive edge. This guide will take you from ground zero to building your own custom apps in ServiceNow, providing practical examples and referencing valuable resources along the way.
Understanding the ServiceNow Application Development Landscape
Before diving into development, itâs crucial to grasp the foundational elements of application building in ServiceNow. Think of it as understanding the toolkit before starting a construction project.
1. Tables: Tables are the fundamental data structures in ServiceNow, similar to tables in a relational database. They hold the information your application needs to manage. Common examples include:
- Incident: Used in ITSM to track incidents.
- Change Request: Used in ITSM to manage changes to IT systems.
- User: Contains user information.
2. Forms: Forms provide the user interface for interacting with data stored in tables. They display fields, allow users to input data, and trigger actions.
3. Client Scripts: These scripts execute in the userâs browser, enabling dynamic behavior on forms. For example, you can use client scripts to:
- Validate user input.
- Show or hide fields based on other field values.
- Make read-only based on specific conditions.
4. Business Rules: Business rules execute on the server-side, performing actions based on table events (e.g., when a record is inserted, updated, or deleted). Examples include:
- Sending notifications when a record is updated.
- Calculating field values automatically.
- Preventing unauthorized modifications.
5. Workflows: Workflows automate multi-step processes, orchestrating tasks and approvals. Think of them as digital assembly lines. Examples include:
- Approval processes for change requests.
- Automated onboarding workflows for new employees.
- Incident resolution workflows.
6. Script Includes: Reusable server-side scripts that can be called from other scripts, like business rules or workflows. They promote code reusability and maintainability.
7. UI Policies: UI policies allow you to dynamically control the behavior and appearance of forms without writing code. Theyâre useful for simple form customizations.
8. Application Scoping: Application scoping provides a boundary for your application, isolating it from other applications and the base system. This is crucial for security and preventing conflicts. Always develop within an application scope.
Creating Your First Custom Application: A Practical Example â Employee Onboarding App
Letâs walk through building a simplified Employee Onboarding application. This app will manage the process of onboarding new employees, ensuring they have the necessary resources and access.
Step 1: Create a New Application
- In ServiceNow, navigate to System Applications > Application.
- Click Create Application.
- Provide the following details:
- Name: Employee Onboarding
- Description: Manages the onboarding process for new employees.
- Scope: Choose a unique scope name (e.g.,
x_custom_employee_onboarding
).
- Click Create.
Step 2: Create the âOnboarding Taskâ Table
- Within your newly created application, navigate to Data Model > Tables.
- Click New.
- Provide the following details:
- Label: Onboarding Task
- Name: x_custom_employee_onboarding_onboarding_task (This will be automatically generated based on your scope and label).
- Extends table: Task (This inherits common task fields like Assigned to, State, etc.)
- Click Submit.
- Add the following custom fields:
- New Hire: Reference field to the User table (Label: New Hire, Name: u_new_hire, Type: Reference, Reference Table: User)
- Start Date: Date field (Label: Start Date, Name: u_start_date, Type: Date)
- Required Training: String field (Label: Required Training, Name: u_required_training, Type: String)
Step 3: Create the Onboarding Task Form
The form will automatically be created based on the fields you defined in the table. You can customize the layout of the form by navigating to the table record, then clicking âConfigure > Form Layout.â Drag and drop the fields to arrange them as desired.
Step 4: Create a Workflow to Automate Onboarding Tasks
Letâs create a simple workflow that triggers when a new Onboarding Task record is created. This workflow will automatically assign the task to the appropriate HR representative.
- Navigate to Workflow > Workflow Editor.
- Click New Workflow.
- Provide the following details:
- Name: Onboarding Task Workflow
- Table: Onboarding Task (x_custom_employee_onboarding_onboarding_task)
- If condition matches: When to run > record is created
- Click Submit.
- In the Workflow Editor:
- Drag and drop a âSet Valuesâ activity onto the canvas.
- Configure the âSet Valuesâ activity to set the âAssigned toâ field to a specific HR representative (youâll need to hardcode this for now, but you could make it dynamic later).
- Connect the âBeginâ activity to the âSet Valuesâ activity, and then connect the âSet Valuesâ activity to the âEndâ activity.
- Click Publish to activate the workflow.
Step 5: Create a Module to Access the Application
- In your application scope, navigate to System Definition > Application Menus.
- Open your application menu (âEmployee Onboardingâ).
- Create a new module:
- Title: Onboarding Tasks
- Link Type: List of Records
- Table: Onboarding Task (x_custom_employee_onboarding_onboarding_task)
- Save the module.
Now, you should be able to access your âEmployee Onboardingâ application and create new âOnboarding Taskâ records. The workflow will automatically assign these tasks to the specified HR representative.
Example Real-Life Scenario: Automating Hardware Provisioning
Imagine a company with hundreds of new hires each month. Manually provisioning hardware (laptops, monitors, etc.) for each employee is time-consuming and prone to errors. A custom ServiceNow application can automate this process:
- Table: âHardware Requestâ (fields: Employee, Hardware Type, Software Requirements, Approval Status)
- Form: Allows managers to submit hardware requests for their new hires.
- Workflow:
- Request is submitted.
- Approval is routed to the IT manager.
- Upon approval, a task is created for the IT department to provision the hardware.
- Once provisioned, the hardware is shipped to the employee.
- Notification is sent to the employee with tracking information.
This automation significantly reduces manual effort, ensures consistency, and improves the new hire experience.
Diagram: Hardware Provisioning Workflow
Best Practices for ServiceNow Application Development
- Use Application Scoping: As mentioned earlier, application scoping is paramount.
- Follow Naming Conventions: Consistent naming conventions make your code easier to understand and maintain.
- Write Clear and Concise Code: Use comments to explain complex logic.
- Test Thoroughly: Test your application in a non-production environment before deploying it to production.
- Use Source Control: Use Git or another source control system to track changes and collaborate effectively.
- Document Your Application: Create documentation that explains how your application works and how to use it.
Advanced Topics
Once youâre comfortable with the basics, you can explore more advanced topics:
- ServiceNow Integration Hub: Integrate with external systems using pre-built connectors or create your own.
- Service Portal: Build custom user interfaces for your applications that are accessible from any device.
- Flow Designer: A low-code alternative to workflows, offering a more visual and intuitive way to automate processes.
- REST APIs: Expose your applicationâs functionality through REST APIs, allowing other applications to integrate with it.
- Automated Test Framework (ATF): Create automated tests to ensure the quality and reliability of your applications.
Resources
- ServiceNow Developer Site: https://developer.servicenow.com/â - Your go-to resource for all things ServiceNow development. Contains comprehensive documentation, tutorials, and code examples.
- ServiceNow Community: https://community.servicenow.com/â - A vibrant community of ServiceNow developers where you can ask questions, share knowledge, and connect with other professionals.
- ServiceNow Documentation: https://docs.servicenow.com/â - Official ServiceNow documentation, covering all aspects of the platform.
Conclusion
Building custom applications in ServiceNow empowers you to extend the platformâs capabilities and tailor it to your specific business needs. By understanding the core concepts, following best practices, and continuously learning, you can transform from a novice to a ServiceNow custom app hero. Start with simple projects, experiment with different features, and leverage the wealth of resources available online. The power to automate and improve your business processes is at your fingertips.