Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Encoding module URIs

Log in to subscribe to topics and get notified when content changes.

Encoding module URIs

Clicking a module name in the navigation pane executes a URI that opens the module's page in the content pane. All the characters in module URIs must be URL-encoded or the link breaks.

Note: If you're upgrading to the New York release or later from a pre-New-York release, your module UIs may break if they do not follow the conventions pre3sented in this topic.

When you create modules, you have the option of adding arguments and filter conditions that sort and/or reduce the number of results displayed in the content pane. When you click a module name in System Definitions > Application Definitions, you can see those conditions and arguments on the Link Type tab.

Link type tab

The argument definition in Arguments and filter conditions defined in Filter become part of the module's URI and must be URL-encoded. ServiceNow automatically URL-encodes filter conditions and appends them to the module URI using sysparm_query. For example, adding the filter condition, Active is true appends sysparm_query=active%3Dtrue to the module's URI; %3D is the URL-encoding for the equals sign (=).

The following table shows when you must URL-encode the argument in the Arguments field and when ServiceNow URL-encodes the argument.

Table 1. Rules for encoding arguments
Has a filter condition? Argument definition starts with Who encodes the argument? How argument is handled
No ^ ServiceNow Removes the caret (^) from the argument, encodes it and uses sysparm_query to append it to the module URI.
No & You Removes the ampersand (&) from the argument and appends it to the module URI.
No Anything else ServiceNow Encodes the argument and uses sysparm_query to append it to the module URI.
Yes ^ ServiceNow URL-encodes the filter definition and the argument and uses sysparm_query to append the combination to the module URI.
Yes Anything else You URL-encodes the filter definition and uses sysparm_query to append it and the (unaltered) arguments to the module URI.

You can turn on (the default) and off the URL-encoding requirement for module UIs using the glide.ui.encode_module_uri property.

Examples

The following examples demonstrate when you have to URL-encode the argument definition in Arguments:
  • There are no filter conditions and the argument definition in Arguments starts with an ampersand, for example,&sysparm_fixed_query=assigned_to=javascript:gs.user_id().

    This argument breaks the module URI because the equals sign and the colon are not URL-encoded, and the ampersand prevents ServiceNow from URL-encoding the argument. URL-encode the argument: &sysparm_fixed_query=assigned_to%3Djavascript%3Ags.user_id().

  • There are filter conditions and the argument definition in Arguments does not start with a caret (^), for example, sysparm_name=Barnes & Noble's.

    This argument breaks the module URI because the ampersand and spaces are not URL-encoded. URL-encode the argument: sysparm_name=Barnes%20%26%20Nobel's

Feedback