Article

Tips and Tricks – 5 Tips That Speed Up Your ServiceNow Workflow

Tips and Tricks – 5 Tips That Speed Up Your ServiceNow Workflow

As a ServiceNow Solutions architect, you know it’s important to work fast but also produce accurate results. For instance, inaccurate server-side scripts on your GlideRecord are a definite no-no. And handy keyboard shortcuts will definitely speed up your day. In this blog, I’ll reveal a few ease-of-use ServiceNow tips and tricks I use regularly. Check them out and become the Solutions Architect your teammates want to be like!

Tip #1 – GlideRecord Server-Side Script

What would happen if the values of the GlideRecord class were inaccurate in a server-side script? Broken code logic that doesn’t match any correlation_id_value? Or worse? For one, getting the right values enables the GlideRecord API to interact with the ServiceNow database from a script.

Dot-walking in ServiceNow provides access to fields on related tables from a form, list, or script. If the current table contains a reference to another table, any field on the referenced table can be accessed using dot-walking.

  • Area: Server-side scripting
  • Type: Script
  • Purpose: When you need to pull all values from a GlideRecord into a client script (or other script) that doesn’t have access to your dot-walk.
  • Script:
    • //get all values of a GlideRecord
    • var gr = new GlideRecord(‘<table>’);
    • get(‘<sys_id>’);
    • for (var i in gr) {
    • info(i + ‘:’ + gr[i]);
    • }

Tip #2 – Cancelling a Transaction

Is the on-screen timer taking too long or worse, hanging and not allowing you to cancel out of it? Canceling transactions is definitely a headache, but finding out how to actually cancel it is even more challenging. You’ve got more pressing things to do than wait for it to correct itself (if it ever does).

Fortunately, ServiceNow makes it easy to formally cancel the transaction. For example, when you open a list of records (sys_audit, Syslog, task) and it’s taking an unusually long time to open, you can attempt to stop it with the “cancel transaction” command.

However, if the transaction does not stop—or it hangs—actively canceling the transaction allows you to override and cancel it. The ServiceNow instance completely stops the transaction running on the front end.

  • Area: whole platform
  • Type: browser URL command
  • <servicenow instance url>/cancel_my_transaction.do

Tip #3 – Common Navigator commands

A great addition to Tips and Tricks is the Navigator command. it allows you to open a table’s list view and filter the results to see only what you need to see, filtering out results that are unnecessary.  This is the perfect command to use for very large tables like task, sys_audit, Syslog, etc.

    • Area: Navigator
    • Type: Navigator shortcut command
    • Commands:
      • <table name>.filter

    • <table name>.FILTER
      Does the same as above, but opens in a new tab
    • <table name>.do
      Opens a new record on the table to circumvent the absence of a “New button” for a table list.

    • <table name>.list
      Opens a table list.

Tip #4 – Decoding a ServiceNow URL in script

Decoding a ServiceNow URL is not always possible because the URL may be twice encoded. If so, it needs to be decoded twice. An example of a twice-ended URL: https://instance.service-now.com/nav_to.do?uri=%2Fsc_req_item_list.do%3Fsysparm_query%3Dcat_item%253D7e4c1e001b90f450bdf62173b24bcb6f%255Estate!%253D3%255EORstate%253DNULL%26sysparm_first_row%3D1%26sysparm_view%3D

  • Area: Client-side Scripting
  • Type: Script
    • Note: Below is a sample script you can use to decode a ServiceNow URL:
      • var url = ‘https://instance.service-now.com/nav_to.do?uri=%2Fsc_req_item_list.do%3Fsysparm_query%3Dcat_item%253D7e4c1e001b90f450bdf62173b24bcb6f%255Estate!%253D3%255EORstate%253DNULL%26sysparm_first_row%3D1%26sysparm_view%3D’;
      • var urlx = decodeURIComponent(url);
      • info(decodeURIComponent(urlx));
    • Note: If you want the cat_item sys_id by parsing the URL, you would not be able to simply decode the URL, you need to double-decode to get the actual value:
      1. Initial decoding removes the URL encoding. After the URL encoding is removed you must then
      2. Remove the ServiceNow encoding for the query parameter. With a clean URL, you can now parse the parameters and get the value you need.

Tip #5 – Keyboard Shortcut for javascript on-screen execution tool

I use the Keyboard Shortcut to test certain client-side code or to manipulate forms for debugging. You can also use this shortcut in list views and forms views.

      • Area: Internal SN UI (not portal)
      • Type: Keyboard shortcut
      • Shortcut: CTRL+SHIFT+J

Keyboard shortcut

Learn More

Our Solutions Architects are always looking for ways to help you work better with ServiceNow. To find out more and learn more tips and tricks, Connect with the Milestone team at itsolutions@milestone.tech.

ServiceNow Tips and Tricks from Commands to Scripts

 

Facebook
Twitter
LinkedIn
Categories

Select a Child Category
category
66485f794f1c4
1
0
226,352,350
Loading....
Recent Posts
Social Links

Related Posts

Want to Learn More?

Milestone experts take the time to listen, understand your needs, and provide the right mix of tools, technology, and resources to help you meet your goals.

Request a complimentary consultation to get started.

Request a Complimentary Consultation

Skip to content