- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
2 hours ago
Pattern Development Best Practices for ServiceNow Discovery and Service Mapping
Designing efficient, scalable, and upgrade-safe patterns is essential for maintaining a healthy Discovery and Service Mapping implementation in ServiceNow. Poorly written or heavily modified patterns can introduce long-term technical debt, degrade MID Server performance, and break during upgrades.
Below are practical best practices to ensure your patterns remain optimized, maintainable, and aligned with the platform’s long-term stability.
- Avoid Hardcoding Values Inside Pattern Steps
Hardcoding values such as IP addresses, ports, or hostnames inside pattern steps may seem convenient during initial testing, but it creates long-term maintenance challenges.
Best practice: Always use dynamic variables and reusable pattern inputs wherever possible.
This ensures your patterns remain:
- Portable across environments
- Easier to troubleshoot
- More reusable and scalable
- Do Not Modify Out-of-the-Box (OOB) Patterns Directly
Directly changing OOB patterns or library patterns is not recommended and is considered a poor practice. These changes are often overwritten during upgrades or plugin updates, leading to loss of work and broken Discovery behavior.
Instead, use one of the following recommended approaches:
Approach 1: Clone the OOB Pattern
- Clone the OOB pattern
- Prefix your custom version (for example: Custom – Windows OS Pattern)
- Apply all changes only in your cloned pattern
Approach 2: Use Extension Steps
If the change is minor, avoid modifying the Identification or Connection logic.
Instead:
- Implement changes in extension steps
- Add comments in the Pattern Designer explaining:
- Why the pattern was modified
- What the change impacts
- When the change was introduced
This preserves upgrade safety and provides helpful history for future maintainers.
- Document Pattern Changes Clearly
Even when cloning patterns or using extension steps, documentation is essential for maintainability.
Make sure to:
- Add meaningful step comments in the Pattern Designer
- Explain the intent behind the change
- Document what was modified and why
This reduces confusion during troubleshooting and makes upgrades and audits significantly easier.
- Avoid Unnecessary API Calls or Long-Running Commands During Pattern Execution
Excessive API calls (either to the ServiceNow instance or external systems) can significantly slow down Discovery and increase MID Server load.
In addition, long-running commands, especially those using application credentials—can cause delays and performance issues.
Best practice:
- Avoid calling APIs repeatedly inside loops
- Retrieve required data once and reuse it through pattern variables
- Watch for long-running commands in Discovery logs
- Be cautious with SQL commands (Applicative Credentials) and heavy OS-level scans
This helps prevent:
- MID Server overload
- Slow pattern execution
- CPU spikes on target hosts
- Increased Discovery cycle time
- Perform Impact Analysis Before Publishing Pattern Changes
Before publishing any pattern changes, it is critical to perform an impact analysis. This is one of the most valuable best practices because it allows teams to take a proactive approach instead of reacting after issues occur in production.
Impact analysis helps you understand:
- How many servers this change will affect
- Which applications may be impacted
- Which Service Maps may break or behave differently
How to Perform Impact Analysis
A simple and effective way to perform impact analysis is by using the Discovery Pattern logs.
- Navigate to the Discovery Pattern Logs table:
sa_discovery_log - Search for your pattern name in the logs.
- Identify the field called Managed IP.
The Managed IP field provides a complete list of IP addresses where the pattern is executed. This gives you visibility into the full scope of hosts that may be impacted by your change in the patterns.
Conclusion
Patterns are one of the most powerful building blocks in ServiceNow Discovery and Service Mapping. Following these best practices helps ensure your patterns remain:
- Efficient
- Scalable
- Upgrade-safe
- Maintainable
- Performance-friendly
Small improvements in pattern design can significantly enhance Discovery reliability, reduce operational overhead, and protect Service Mapping accuracy.
Some advanced KB articles in Pattern development for reference:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0647736
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0597728
Note: These best practices are based on my experience working in the ITOM space. There may be additional best practices—please feel free to share your thoughts in the comments.
Regards,
Srinija Amisthapur
ServiceNow Rising Star 2025
Certified Technical Architect
