How to cheat mandatory fields – ServiceNow

This have been working on ServiceNow for years and it still not noticed enough. It works on Service Portal, Platform and Workspaces. You do not need any roles to do this and this can sometimes help you or give you a headache.

As long as it is a mandatory text field, you can put NULL as a value and save it. Mandatory check thinks it is a text, but once saved – the value returns to its ‘initial’ state which is null in the database, therefore value becomes empty.

This is kind of documented, as admins can do it via script, however, actually anyone can do it directly in forms.

ServiceNow Clean Up: Clear system logs from meaningless JAVA exceptions

It is mandatory to monitor ServiceNow system errors and warnings to ensure your instance has up to date fixes ready before issues a brought over via incidents. However, not all system logs are meaningful and some of them can be ignored or hidden.

To hide any JAVA exceptions that have no meaning to SN customers you can create a system property:

Name: glide.client_abort_exception_names

Type: CSV string

Value example: org.apache.catalina.core.AsyncContextImpl.dispatch,RrdException,com.glideapp.report_charting_v2.exceptions.ChartDataGenException

Note: primary reason to disable exception logs, rather than hiding via filters is because not all logs can be hidden and there is a limit how many filter conditions you can have. Also report performance is increased significantly as well.

Warning: you must be well aware of the issue that generated the log and only then decide to hide it, otherwise serious issues might be left unnoticed.

This should be reviewed after every upgrade as well to ensure exceptions are still relevant and have not been removed by SN or other issues with same exception were introduced.

NOW Experience: how to open a New Tab via dispatch

You can open new tab in Agent Workspace in 2 ways: 1) Via component; 2) Via Client Script.

UI Component

Component does not require any dependencies. The action name to open a new record (new tab) is called ‘REFERENCE_INFO_CLICK’. If we create a component and put it in the contextual side panel, when the button is clicked, it will open a new tab with provided details, or if the tab is open it will switch to the tab itself. This component can be used anywhere in AW, not just side panel.

import { createCustomElement } from '@servicenow/ui-core';
import snabbdom from '@servicenow/ui-renderer-snabbdom';

const REFERENCE_INFO_CLICK = 'REFERENCE_INFO_CLICK';

const view = (state, { updateState, dispatch }) => {
    return (
        <div>
            <button on-click={
                () => {
                    dispatch(REFERENCE_INFO_CLICK, {
                        "referenceInfoClick": {
                            // Table of record you want to open
                            "referencetable": "sys_user", 

                            // Record you want to open sys_id
			    "sys_id": "6816f79cc0a8016401c5a33be04be441" 
			}
		    });
                }
            }> Open New Tab</button>
        </div>
    );
};

createCustomElement('x-177418-dispatch-new-tab', {
    renderer: { type: snabbdom },
    view,
});

Client Script

You have to use GlideAgentWorkspace (g_aw) API. This one is fully documented here. For example:

g_aw.openRecord("sys_user", "6816f79cc0a8016401c5a33be04be441");

You can see in the source code g_aw.openRecord actually uses PREVIEW_RECORD dispatch which can be used in the component like this as well: