HolySN

List switches

The flags you add to a command to filter, group, order and redirect a list, and what happens when the instance cannot honour one.

A switch is a token starting with - typed after a command. They work on any command that opens a list: the artefact commands, any table you reach by name, and the platform routes.

Type a command and a space to see the reference panel for it, and keep typing to narrow it. A command that does not take switches never shows the panel, and there a - is simply part of what you typed. /search -a searches for the text -a.

Anything starting with - is never folded back into the search term. That is deliberate: a typo should be an error, not a silently wider result set.

Filters

SwitchMeans
-aActive only
-sThe current application scope
-umUpdated by me
-cmCreated by me
-mTouched by me, created or updated
-utUpdated today
-ctCreated today
-uctTouched today, either way

Time windows

The shape is -<type><number><unit>.

The type is u updated, c created, uc either, um updated by me, cm created by me.

The unit is m minute, h hour, d day, w week, M month, q quarter, y year. The case matters: M is a month and m is a minute.

So -u5d is updated in the last five days, -c3h created in the last three hours, -uc15m touched in the last quarter of an hour, and -um1w updated by me this week.

Two things there are the platform's rules rather than ours. ServiceNow has no relative week and no relative day: a week is expressed as seven days of the week, and a day as one day of the week. And it has no relative second, so a second is refused rather than rounded.

One field

-<field>:<value> matches that field. Dot-walking works: -assigned_to.name:abel.

Grouping and ordering

SwitchMeans
-gb:<field>Group by that field
-ouNewest updated first
-ocNewest created first

Only the first ordering switch counts, and grouping takes the primary sort when both are given.

How the list is drawn

SwitchMeans
-fShow the filter, and pin it
-pPin the filter
-gaGrouped lists sorted by count, ascending
-gdGrouped lists sorted by count, descending
-pfThe classic UI rather than the current one
-poOpen bare, without the application navigator around it

-po is spelled with two letters because -p already means pinning the filter.

Where it opens

SwitchMeans
-itOpen in a new in-page tab instead of a browser tab

-it works on every command that takes switches, custom commands included. It only takes effect while the in-page tabs are on and the page is one they can host. Otherwise the command opens where it always does, so the switch never leaves you with nothing.

Switches that change the destination

These replace the list rather than filtering it, and only the first one counts.

SwitchGoes to
-tThe table's dictionary: its structure
-cThe table's configuration record
-nA new record on that table
-rA random matching record, after asking the instance how many there are
-raThe REST API Explorer for that table
-erdThe schema map, with every relation shown

When the instance cannot honour one

This is the part that matters, and it is why switches are validated at all.

An unknown switch is an error. The command refuses and the palette stays open with the message. It is never ignored, because ServiceNow does not reject a condition it does not understand: it silently drops it and answers with more rows than you asked for. A query that quietly widened is worse than one that did not run.

A field the table does not have is caught before the query runs. Both -gb: and -field:value are checked against the table's real fields, inherited ones included, and the message names the field. The check reads one real row and takes its keys, cached per table.

A table with no rows cannot be checked, so the command runs unvalidated rather than refusing. There is nothing to read the field names from.

-r with nothing matching says there is no random record to open, rather than opening something arbitrary.

A refusal while impersonating carries an extra sentence: the request ran with the other person's rights, and /unimp stops that. A 403 that your own account would not have hit is the most confusing failure in ServiceNow, so it is named rather than passed through.

A switch a list simply ignores, such as grouping on an ungrouped list, has no visible effect and nothing reports it. It is a URL parameter, and the platform is free to ignore it.

Where a switch exists in another tool and not here, it is left out of the reference panel rather than accepted and dropped, so that the gap is visible.

List switches | HolySN