Let's say you're working for a company who has just acquired another company, and you've just imported all of the users from the acquired company's User (sys_user) table.
Unfortunately, you realize just a second too late, that their user database contains some of the same people as are already in your database - for example, some executives had accounts in both services.
Or maybe you were previously running the instance without enforcing number uniqueness on the incident table for some reason, and you want to change that.
The first step to resolving these issues, is detecting duplicate records, based on a given field. Here's a simple script include that will do that for you:
Array.indexOf() not working in ServiceNow - Solution!
I'm baffled that this little issue has never cropped up for me until now, but I recently discovered a little annoyance in ServiceNow while iterating through an array. This issue had me going round in circles for hours, so hopefully by sharing my findings with our readers, I can spare some folks the frustration I felt.
First, I'll tell you a little story about how it happened to me, and then I'll tell you the explanation for this odd behavior.
Read moreUnderstanding Dynamic Filters & Checking a Record Against a Filter Using GlideFilter
I recently found myself in a situation where I had to check if a given record (the 'current' object in my case) matched a filter associated with another record (a client script, in my case). If you find yourself needing to do something similar, it might help you to know about an undocumented Glide API called "GlideFilter".
GlideFilter takes two arguments:
- A glide record containing the record you'd like to check
- The query string (aka "encoded query") you'd like to check it against.
The first argument may be self-explanatory - it's a GlideRecord object containing a single record.
The second argument, if you're not familiar with encoded queries, is a string of text that represents a query. If you've ever built a query in a condition builder, you've built an encoded query.
Bookmarklet: Load the current page in the ServiceNow frame
I often find myself middle-clicking a link or otherwise opening links in ServiceNow in a "new tab" or "new window". This means that I often get pages that load just the content frame, without the ServiceNow frame.
ServiceNow content frame without banner or application navigator
The frame is the header and side-bar that facilitate easy navigation around ServiceNow, and often times I find that I don't need it. However, when I'm in a tab and don't want to lose my place, but I do want to get the sidebar back, I'm pretty much out of luck. My options then, are to either manually modify the URL with some weird string I can never remember, or to go back to my main ServiceNow instance home page and start from scratch.
Wouldn't it be nice if there was an easier way to load the current page in the ServiceNow frame?
I think so too, so I wrote this little bookmarklet.
Click and drag that link up to your bookmarks bar or wherever you'd like to save it, and you'll have a handy little button that you can click to load whatever page you're on in ServiceNow, in the SN frame.
Easily Clone One User's Access to Another User
If you're a ServiceNow Admin, chances are you get lots of tickets from people asking you to grant or revoke access to this or that.
Sure, onboarding and offboarding, and some basic permissions work, can be automated -- but sometimes you just don't have a catalog item for what the user is requesting, so you have to do it manually.
sigh
So if you're like me, you get these tickets all the time:
"Jerry doesn't have access to the same applications as the rest of our team. Please add him to whatever groups he requires to do his job. Nerd."
Unless you're intimately familiar with Jerry's job, you're going to need some more information to go off of. I normally ask for the ID of another user whose access I can clone, and then open each profile on a separate monitor and go through each group one at a time. I once did 77 groups this way, for two separate users. It was a nightmare...
Read more