Where did I write that piece of code?
EDIT: *The UI Page "CodeSearchExampleUse" mention below doesn't work in Istanbul release, there you need atm. go through the studio*
I have been supposed to write this post for months now, and finally I got the time to do it.
I doubt I'm the only one being in the position where I forgot where I wrote a specific piece of code or that you can see that something is changing the data, but you can't figure out how/where.
Lucky for us, ServiceNow has a solution for us, you just need to search a bit to find it. The solution is named "Code Search". This been around for a while and it pretty much lets you easy search for a piece of code in a lot of places. After read what I could find in the docs, I would guess this is made primary for the ServiceNow Studio and I'll come back to that in the end of this post.
so, here is how to find it:
Code Search itself is an application and you can find it by going to "System Applications->Applications" in the navigator.
Then you need to click on "downloads" and there it appears in the list. You can click on it to get some more information about it.
Looking around in the records it has, you can see that it got a UI page called "CodeSearchExampleUse", let's look at it.
You can see its got a endpoint, so lets click on it and see how it looks like.
Just check the box "Search All Applications" and fill in what you looking for and tada, it gives you the result.
Here you can see that for example there is 2 client scripts having "setValue" within them. It also give us the client script name and even at which row it can be found.
Atm. I can see that it searches through:
- Approval Steps
- Inbound Email Actions
- Style
- Installation Exists
- Client Script
- Validation Script
- Scheduled Script Execution
- Relationship
- Macro
- UI Page
- AJAX Script
- Transform Script
- Notification
- MID Server Script Include
- Access Control
- Map Page
- Workflow Activity Definition
- Knowledge Nav-ons
- Schedule Item
- Table Transform Map
- UI Script
- Business Rule
- Dynamic Content
- Email Template
- BSM Map Actions
- Processor
- Script Include
- UI Action
- UI Policy
- Widget
- Script Action
So it's quite the list and a real nice help to find stuff.
But it's some clicks to get to the search page and sadly there isn't an application with modules done for this. But you can make your own.
This is what I have done:
I've made my own application with modules that I use often and I put CodeSearch as one module. The module looks like this:
And just to show you what I meant with it exists in studio, this is where you will find it:
So there you go. I hope this will help you in the search of code as it has done for me.
Take care,
Göran
https://www.servicenow.com/community/developer-blog/where-did-i-write-that-piece-of-code/ba-p/2292622