ServiceNow® Studio Code Search: A Developer’s Best Friend

Since the release of Geneva, ServiceNow Studio has been included for developers to aid in creating and managing custom applications in one centralized place. I’m not going to dive into the different options and tools that are available within this application, but rather focus on a single piece of functionality included with Studio: Code Search.

Code Search can be very useful in troubleshooting or just to help you understand how something works within your instance. It allows you to scan all scripts globally or at the application level. Instead of having to apply filters on the business rules or client scripts one search at a time, Code Search can return results for all tables and all scripts. Let’s dig in.

1. As an Admin within your instance, navigate to System Applications > Studio. If you don’t have an Application to open, you can create one. It only takes a few clicks:


2. Once you have the application open in the editor, you can begin your search. You can click “Code Search” in the top right or use the correct shortcut for your platform.

  • Windows: Control+Shift+F
  • Mac: Command+Shift+F

3. Enter in your case sensitive search term and optionally customize your search by selecting a table (Access Control, Business Rules, Client Script, etc.) or click the “Search in all applications” checkbox. This checkbox allows you to search across the entire instance and not just within the current application you are editing. To learn and debug your instance, I would recommend utilizing this checkbox.

4. Now let’s jump into an example search. Say I wanted to do a global search on “work_notes” to see how it’s being used across the application. This is what I’ll see:


5. Clicking Search will return all scripts that reference “work_notes” as seen below:


Do you see how powerful this is? I now have all my scripts nicely grouped with the line of code where my search term is referenced. From here I can open any script in a new tab and make any code changes necessary.

The more I use Code Search, the easier my life gets, whether I’m troubleshooting, developing, or just seeking to gain understanding. The only limitation I’ve found is that there is currently no built-in logic to return Service Portal code used in widgets. I’m hoping this will be included in future releases!

I think you’ll find Code Search to be an invaluable and convenient tool to help you develop a very happy instance. But be warned, your old best friend may become jealous with the amount of time you are spending with your new best friend, Code Search.

Contributor: Michael Mecucci, Aptris Consultant