5 More ServiceNow Tricks and Hidden Features for Developers and Advanced System Administrators (Part 2)
Part I of our blog series explored 5 More ServiceNow tricks and hidden features for advanced users and system administrators. Now, we will review some out-of-the-box features for developers or more experienced system admins.
1. Studio Code Search
If you’ve used ServiceNow’s Studio to develop custom applications, you’re probably already familiar with this feature. For system administrators, however, searching for code regardless of scope has never been easier. This is a fantastic feature if you’re looking for a particular code snippet (a class, a function, even a comment!), especially for something in the Global scope. To access the Code Search utility, navigate to the “Studio” module of the “System Applications” application menu. Select an application first, but don’t worry. You won’t be making any modifications to the custom app and you can change your scope later. In the top right side of the screen, select “Code Search”. In the box that appears, enter your search term and select the checkbox labeled “Search in all applications”.
NOTE: Don’t forget to change your scope back to what it was after the code search is complete.
2. Inbound REST API Explorer and Outbound REST API logging
Working with any system’s APIs is challenging, but ServiceNow has several fantastic tools that make developing integrations a whole lot simpler. In addition to their comprehensive API documentation on their Developer site, ServiceNow also provides users with a unique tool to build and test inbound REST messages inside the ServiceNow platform. The REST API Explorer allows you to select any ServiceNow API and try out a GET, POST, PUT, DELETE, or PATCH call against data in the instance. To access the REST API explorer, you’ll need the rest_api_explorer or admin role.
For outbound REST messages, ServiceNow offers the Outbound HTTP Requests log, which lives under the “System Logs” application menu. Here you’ll find a list of all outgoing HTTP messages from the system, alongside the URL, response code, response body, and information about the ServiceNow source (Workflow, Scheduled Script, etc.) that initiated the HTTP request. Outbound HTTP logs are available for users with the web_service_admin role.
3. Stealth modify data with setWorkflow() & autoSysFields()
Making corrections to records in your database, especially in bulk, can be a problem. Especially if you have items such as Business Rules, Workflows, or Reports that trigger when a record is updated. To sidestep this limitation, ServiceNow introduced two useful GlideRecord functions: setWorkflow() and autoSysFields().
setWorkflow() – Enables or disables the running of business rules, script engines, and audit. Pass in the Boolean “false” to disable objects that are designed to run after a record update. This function is available for Scoped applications.
autoSysFields() – Enables or disables the update to the fields sys_updated_by, sys_updated_on, sys_mod_count, sys_created_by, and sys_created_on. This is often used for manually updating field values on a record while leaving historical information unchanged. This function is NOT available for Scoped applications. Use this function with extreme caution and review the documentation carefully.
As a developer, this one is quite possibly my favorite feature in ServiceNow: the ability to run freeform server scripts against the system with the “Scripts – Background” module or with the superior feature Fix Scripts. If you’ve worked with client-side code, you know testing a simple GlideForm message or testing a GlideAjax call isn’t straightforward. If you’ve been looking for the client-side equivalent for Background/Fix scripts in ServiceNow, you are in luck.
5. ServiceNow Style Guides and System icons
Although less relevant nowadays with the phaseout of the Content Management application and the decline of Jelly scripting in the system, understanding ServiceNow’s design elements is still a useful skill for designing UI Pages or Macros and other components of the default UI. ServiceNow has a couple of older pieces of documentation containing information about a variety of UI components and associated design principles: the ServiceNow Design System and the ServiceNow Style Guide. Additional ServiceNow instance additions include the Image Picker and Icon Library. These allow you to access system icons that are referenced in client-side scripts.
There are a number of useful plugins in ServiceNow that can be installed to optimize your instance even further. Check out our posts on Archiving and the Automated Test Framework to learn more, or check out the ServiceNow Store or Share sites.
Hopefully you learned something new for our list of tricks and hidden features for advanced ServiceNow system administrators and developers! What’s your favorite ServiceNow secret? If you’d like to learn even more ServiceNow tips and tricks, connect with the Milestone team at email@example.com. You can also check out another one of our ServiceNow tips and tricks blogs here.