Skip to content

Features

Markus Kraus edited this page Jul 6, 2024 · 3 revisions

All DevOps+ features need to be enabled per-user via DevOps+ > Preferences.

image

Show Hidden Metadata

This feature has been added because some OOTB forms lack certain fields which are crucial to foresee consequences when modifying certain records.
For example several application files lack the "Application" (sys_scope) field. This might leave you under the impression that you're currently modifying a data record while in fact you will unknowingly pollute your Update Set.
The behavior of this feature can be controlled via the property x_424426_devops.hidden_metadata.
image

Context Menu

This feature is the heart of DevOps+, it allows you to customize the OOTB Context Menu on form headers + elements and filter breadcrumbs (on lists).
Most actions detect the modifier keypress which results in new windows being opened (instead of in-frame GlideModal popups).
Note: On lists (header + cells), the context menu can already be customized for years.

image

Form Header

The following actions can be performed on all forms via ☰ > DevOps+ ("Additional Actions"):

  • sys.scripts: Opens the current record as a pre-formatted script you can perform script-based record updates

  • /nav_to: Reopens the current page with using the nav_to URL-prefix so that the instance header is shown

  • filter (sys_id): Shows the current record opened in a list view (filtered by the record's Sys ID)

  • references: Shows all records directly referencing the current record (use Code Search) for a deep search
    image\

  • translated: Submenu which shows all enabled languages to preview the current record in the selected language

Form Elements

image\

  • sys.scripts: Opens the current record as a pre-formatted script you can perform script-based record updates.
    image\
  • filter: Filters the current table for all records matching the current field and value (think of it as a "Show Matching" but for forms)
    image\
  • get: Copies the fields value to the clipboard (use case: get the value of a reference field without "Show XML")
  • set: Opens a prompt to change the fields value (use case: edit read-only fields as admin)
  • path: Copies the (potentially) dot-walked column_value of the current element
  • open: Opens the current reference (or list) (use case: readonly_clickthrough is not enabled and the field is readonly)
    image\
  • translations: Shown on every translate-able field for creating or fine-tuning field translations\
image

Breadcrumbs

  • sys.scripts: Opens a Background Screen Window with a script pre-formatted of the current filter (GlideRecord or GlideAggregate and using addQuery/addOrCondition)
  • setFilter: Opens simple prompt containing the encoded query for the user to modify

List Header

  • /nav_to: same logic as form
  • translated: same logic as form

Code Search

The Code Search was initially based upon the OOTB code search which unfortunately does not support a search on files without that are are missing the sys_class_name ("Extensible = false"). This was commented as "wont fix" by a ServiceNow dev - so I was forced to implement it on my own.
My Implementation has some advantages over the OOTB search (which by the way is also used by snutils):

  • Flows and Workflows are searched and properly searched
  • Form and List Layouts are properly searched
  • All fields are searched
  • Custom Search Scripts can be added and shared with other admins

The Code Search can be either directly accessed or via hotkey (if enabled in preferences):
image

Example: Search Tasks by Short Description

Create a new user preference to your name (or system=true if you want to share it with others):

  • Name: devops_code_search_script_CUSTOM_POSTFIX (Note: The postfix is unused except for ordering purposes
  • Description: Label which appears in the Search Page
(function (action, params, table, context) {

  if (action == 'config') {
    // config gets requested once you hit the Search Button (action + params are set)
    return {
      tables: ['task'], // a list of tables needs to be returned here
      // collect all required variables in the context object
      // this will be passed in the next call to this function when iterating over the tables
      // Note: You also need to store the 'term' in the context object!
      context: {
        term: params.term,
        fields: ['short_description'],
        scope: params.scope
      }
    };
  }
  else if (action == 'search') {
    // perform the actual search: the function will be called for every table previously returned via 'config'
    // (together with the context object)
    // params will be null in this case
    var taskGr = new GlideRecordSecure(table);
    // adding query dynamically (just for demonstration)
    context.fields.forEach(function(f) { taskGr.addQuery(f, context.term); });
    taskGr.query();

    var result = {
        tableLabel: taskGr.getLabel(),
        hits: []
    };
    // the util is used to generate the match data structure
    var util = new x_424426_devops.CodeSearchHandlerBase();

    while (taskGr.next()) {
      // the getMatches function automatically searches the record for the term and formats the results
      var matches = util.getMatches(taskGr, context.fields, context.term);
      if (matches.length) {
        result.hits.push({
          name: taskGr.getDisplayValue() || taskGr.getUniqueValue(),
          className: taskGr.getRecordClassName(),
          matches: matches,
          sysId: taskGr.getUniqueValue()
        });
      }
    }

    return result;
  }

})(action, params, table, context);

Show Version History

On all application files (sys_metadata) you will have a related list that allows you to revert/compare.
Note: The related link will only be shown if the OOTB "Versions" related list is not shown.
image

Clone this wiki locally