DevTools 1.48.0

Welcome to the DevTools - created and maintained by Sascha Wildgrube.

Overview

DevTools contains a number of script includes with useful javascript functions and classes like a GetType() function that really works. A few UI improvements like the Re-Test button in the test result form and shortcuts to various - sometimes hidden - views and system properties in your instance.

Disclaimer

DevTools is NOT an officially supported ServiceNow product.

DevTools does NOT come with any kind of warranty. If you use it, you own it!

Some features contained on DevTools and the techniques being used might be considered as a violation of security policies. Please make sure any use is based on conscious choice and careful assessment. This specifically applies to the functions RunScriptInScope() and RunScriptInGlobalScope() - which are used in many DevTools functions internally. These features are enabled by setting the system property glide.record.legacy_cross_scope_access_policy_in_script to "true".

System Requirements

Installation

  1. Create an account on GitHub - if not done already.
  2. Create a personal access token for your GitHub account.
  3. Add credentials to access GitHub - use "Basic Auth".
  4. Fork the repository https://github.com/saschawildgrube/servicenow-devtools.
  5. Go to Studio and import the DevTools application from source control.
  6. Set the system property glide.record.legacy_cross_scope_access_policy_in_script to "true".
  7. The x_snc_devtools.AppInstall() function must be executed.
    Run the following script as a background script in scope x_snc_devtools:
  8. x_snc_devtools.AppInstall();
  9. Set the sn_atf.runner.enabled system property to "true" to activate the ATF test execution - if not set already.
  10. Run the DevTools test suite.
  11. In case of errors:
    1. In a domain separated instance it may be necessary to switch to the topmost domain to pass all tests.
    2. If the test "DevTools - RunScriptInGlobalScope" fails: Retry after a few minutes. Some cross-scrope privileges will be set up during the first test run and might take a few minutes to be effective. The function RunScriptInGlobalScope() is used in many other functions, so do look into any other failed tests as long as this test fails.
    3. Tests "DevTools - TestDataAPI": These scripts create various records (e.g. incidents, problems, etc.). If there are customizations in place that make additional fields mandatory, you may have to set up business rules to set these values - but only if the short description (or the corresponding field) starts with "_ATF_".
    4. If the "DevTools - Test data sanity" test fails you can use the following script to clear existing test data:
    5. var testdata = new x_snc_devtools.TestDataAPI('_ATF_DEVTOOLS_');
      gs.info('Before DeleteAllData(): '+x_snc_devtools.RenderValue(testdata.GetAllData()));
      testdata.DeleteAllData(testdata.GetAllData());
      gs.info('After DeleteAllData(): '+x_snc_devtools.RenderValue(testdata.GetAllData()));

Features

Script Includes and UI scripts

DevTools contains a wide varienty of functions and classes (server-side and client-side) for re-use. Please refer to the reference section for details.

Cross-scope Scripting

The function RunScriptInScope allows to execute code in any scope no matter what the current execution scope is. The function RunScriptInGlobalScope specifically allows code execution in the global scope from any other other scope. This allows the use of API functions and classes which are only available in the global scope and NOT in scoped scripts. This allows more flexibility when developing scoped apps - and effectively removes any barriers between apps. The authors of DevTools believe that this is a good thing. Application scopes are NOT a security boundary. Scoped APIs have just not been implemented completely - so using these techniques serves as a workaround for incomplete scoped API implementation. It also allows scoped apps to interact with each other which would otherwise be impossible. We also believe that deployments via update sets are a method of the past. Features should always be deployed as part of scoped (or global scoped) applications via source control or AppRepo. This however requires such apps to perform installation steps - like manipulations of OOTB records - which would not be possible from within their own scope. Hence cross-scope scripting techniques finally enable fully automated deployment pipelines without the need of any manual interventions.

Field Formatting

DevTools can help to format (float) numbers in forms, related lists and list views in the classic UI. Follow these steps to activate the feature:

  1. Set the DevTools system property ui.formatting to "true".
  2. Implement the DevTools extension point.
  3. Implement the function DevToolsGetFormatConfig using the following template:
    function DevToolsGetFormatConfig(grRecord)
    {
    	var strTable = grRecord.getRecordClassName();
    
    	if (strTable == 'your_table')
    	{
    		var formatconfig = {
    			your_field: {
    				decimals: 2,
    				postfix: ' %'
    			}
    		};
    		return formatconfig;
    	}
    
    	return false;
    }
  4. Replace "your_table" by the name of the table that contains the fields to be formatted. Add support for more tables if needed.
  5. Replace "your_field" by the name of the field to be formatted. Add more fields if required.
  6. "decimals" specifies how many decimals digits should be used after the decimal delimiter.
  7. "postfix" specifies a constant string to be added after the formatted number.
  8. Note that the function will be called for each individual record, so the formatting can be dependent on other values of the same record.
  9. You may consider session or transaction caching techniques to improve performance.

Service Portal Deactivation

DevTools allows you to deactivate specific Service Portals.

A new field "Active" is added to the sp_portal table. Once set to false, the corresponding Service Portal will just disappear and is no longer accessible.

Fix the Flow Execution Domain Issue described in KB0998966

DevTools contains the business rule sys_flow_context - Set domain which implements the workaround to the issue described in KB0998966.

Reference

Configuration Options

UI Actions

Script Includes

  • AppBuilder

    AppBuilder adds various application files to a scoped app.

  • AppBuilderAddTestToSuite

    Add an ATF test to an existing test suite.

  • AppGetDependencies

    Retrieves information about the app's dependencies to other apps and required versions.

  • AppGetProperty

    Gets a DevTools system property.

  • AppInstall

    This script installs DevTools

  • AppSanity

    Performs a number of changes to a scoped app's assets to maintain application sanity. E.g., the function removes the copied_from attribute in atf tests, removes unneccesary field level ACLs and removes the is_private flag from system properties.

  • AppSetProperty

    Sets a DevTools system property.

  • ArrayAppend

    Appends the second given array to the first.

  • ArrayPushUnique

    Adds a value to an arry if it doesn't exist yet. Returns the resulting array.

  • ArrayRemoveValue

    Removes a value from an array.

  • ArrayUnique

    Returns an array with unique values only.

  • ArrayValueExists

    Checks if a value exists in an array and returns true in that case, otherwise false.

  • BusinessRuleGetOperation

    Returns the operation (of a business rule) based on the provided record.

  • CacheFlushMenu

    Clears the application menu cache.

  • Clone

    Creates a copy of the given value.

  • CreatePDFFromHtml

    Create a PDF file based on html and attaches the created file as an attachment to the given record.

  • CreateQRCodeRawData

    Creates the raw data for a QRCode based on a given input string.
    The result is provided as an array of rows containing arrays of boolean values for each column.

  • CurrencyConversion

    Converts a monetary amount from one currency to another.

  • DatabaseIndexCreate

    Creates a new database index if it doesn't exist yet. Warning, there is no way to undo that operation!

  • Debug

    Produce a debug log output but only if x_snc_devtools.debug.log is set to true.

  • DevToolsClientAPI

    The DevToolsClientAPI is a client callable proxy for ajax calls to some of the functions provided by DevTools.

  • DevToolsWorkerAPI

    The DevToolsWorkerAPI class contains proxy functions to functions that do lengthy operations and hence may be executed through a process worker.

  • DocumentationAPI

    The DocumentationAPI helps to render fragments of an HTML page that documents the components of a scoped application.

  • GetAllTables

    Returns an object that contains all details of all tables, including a list of tables that are extended from a table if requested.

  • GetAppName

    Returns the name of a scoped application (and removes any "work in progress" postfixes).

  • GetAppRecord

    Get an application record based on sys_id or scope name.

  • GetAppScope

    Returns the scope name of a scoped application.

  • GetArrayValue

    Returns an array no matter what input type is given and performs necessary conversion if another type is provided.

  • GetBoolValue

    Returns either true or false no matter what kind of value is given.

  • GetCallStack

    Returns the call stack in a structured format.

  • GetCleanAppName

    Strips postfixes indicating unfinished work from an application name based on the given string.

  • GetCountryRecord

    Get a country record based on sys_id, name or ISO3 code.

  • GetCurrentScope

    Returns the currently selected scope from the user session.

  • GetDatabaseViewsFromTable

    Returns the database views which use a given table.

  • GetDateNow

    Returns the current date as a string in UTC.

  • GetFloatValue

    Returns a float value.

  • GetFormatConfigMultiple

    Retrieves formatting information for the fields of the given records.

  • GetGroupsFromUser

    Returns all groups of a given user. An additional filter can be applied to the groups to be returned.

  • GetHash

    Generate a hexadecimal SHA 256 hash string.

  • GetInstanceListPath

    Returns the URL path of a table's list in the instance.

  • GetInstanceListURI

    Returns the URI of a table's list in the instance.

  • GetInstanceListURL

    Returns the URL of a specific record list in the instance.

  • GetInstanceRecordPath

    Returns the URL path of a specific record in the instance.

  • GetInstanceRecordURI

    Returns the URL path of a specific record in the instance.

  • GetInstanceRecordURL

    Returns the URL of a specific record in the instance.

  • GetInstanceURL

    Returns the instance root URL.

  • GetIntegerValue

    Returns an integer value.

  • GetKeys

    Returns all key names of an object in an array. Returns an empty array if no object is provided or no members exist.

  • GetLinkDirectory

    Returns the DevTools link directory with many useful links for admins and developers.

  • GetPackageVersion

    Returns the version of a package if it exists, otherwise false.

  • GetParam

    Returns the specified url parameter as a string value.

  • GetParentRecord

    Get the parent record of a given record if it is possible.

  • GetParentTable

    Returns the parent table of the given table. False if the given table does not exist or is not derived from another table.

  • GetProperty

    Gets a system property independent of its scope.

  • GetPseudoSysId

    Returns a pseudo Sys Id which is valid but VERY unlikely to exist.

  • GetRandomNumericToken

    Get a pseudo-random string token of a given length consisting of numbers only.

  • GetRecord

    Shorthand to get a record from a table based on a sys_id. If the bNoCrossScope parameter is set to true, GetRecord will not attempt to load the record from the global scope if it cannot load it from within the application scope.

  • GetRecordFromTestStep

    Returns the sys_id of the record that has been created or found in the given test step.

  • GetRoleNamesFromUser

    Returns an array with the names the active roles of a user.

  • GetRolesFromUser

    Returns an array with the sys_ids of the active roles of a user.

  • GetScopeSysIdFromPropertyName

    Returns the sys_id of a system property based on its name.

  • GetScriptRecord

    Returns the GlideRecord object that contains the script from which GetScriptRecord() is called.

  • GetShortUniqueString

    Returns a string that represents a version of the input string that does not exceed the specified length. The last characters are replaced by a hash-based alpha-numeric postfix to avoid string collisions.

  • GetStackTrace

    Returns the current call stack as a raw, unprocessed string.

  • GetStringValue

    Returns a string value in all cases. Arrays and objects are converted into comma separated strings.

  • GetTableFromSysId

    Returns the table of the record identified by a given sys_id.

  • GetTablesByColumnType

    Returns all tables which have at least one column with the given type.

  • GetTimeNow

    Returns the number of millisenconds passed since the start of the unix epoch.

  • GetTransactionRuntime

    Returns the number of millisenconds passed since the start of this transaction.

  • GetType

    Returns the type of a value.

  • GetUserRecord

    Get a user record based on sys_id, user_name, name or email address.

  • GetValue

    Returns the value of an object that is (or is not) part of an recursive object without generating errors if the object does not exist.

  • GetVariablesFromRecord

    Retrieves all variables available for a record in an object including their names and values.

  • GlideRecordAddQuery

    Adds query conditions to a GlideRecord based on the given parameter. This can be either an encoded query string or an object containing columns and values to be compared directly.

  • GlideRecordDelete

    Executes the delete member function of a glide record in global scope.

  • GlideRecordDeleteMultiple

    Executes the deletemultiple member function of a glide record in global scope.

  • GlideRecordInsert

    Executes the insert member function of a glide record in global scope.

  • GlideRecordQuery

    Executes the query member function of a glide record in global scope.

  • GlideRecordSetValue

    Executes the setValue member function of a glide record in global scope.

  • GlideRecordSetValues

    Executes the setValue member function of a glide record in global scope for all values provided in the given object.

  • GlideRecordUpdate

    Executes the update member function of a glide record in global scope. If bGhost is set to true, the record update will not trigger any system field updates or workflows.

  • HtmlEncode

    Converts a string to html.

  • HtmlRenderError

    Renders an error message in Html.

  • HtmlRenderImage

    Renders an image that is stored in db_image into an html document.

  • HtmlRenderInfo

    Renders an info message in Html.

  • HtmlRenderLink

    Renders an HTML link.

  • HtmlRenderLinkDirectory

    Renders a link directory with based on a given linkdirectory object.

  • HtmlRenderPageA4

    Renders html elements that exactly reflect a DIN A4 page to support PDF rendering.

  • HtmlRenderQRCode

    Renders a black and white QC code image based on the given payload string as plain vanilla html.

  • HtmlRenderScript

    Renders a script in Html.

  • HtmlRenderScriptUrl

    Renders the html tag required to include a script via url (e.g. from a CDN).

  • HtmlRenderStyle

    Renders a html style tag.

  • HtmlRenderTable

    Renders a table in html.

  • HtmlRenderValue

    Renders any value using RenderValue() into an html document.

  • HtmlRenderWarning

    Renders an error message in Html.

  • HtmlRenderWhatRuns

    Renders a the outcome of the WhatRuns() function for the given tables.

  • HttpRequest

    Performs a single synchronous http request.

  • ImageAPI

    A class representing an image which can be used to generate BMP files or html output.

  • InstallerAPI

    The InstallerAPI class supports scripted installation steps as part of the installation of a scoped app.

  • InstanceReset

    Makes a number of changes to OOTB records to remove or hide not needed features. Use with great care! Undoing some of these changes might be difficult.
    For safety reasons the current date (as an iso formatted string) must be passed as a parameter.

  • InstanceScanGetScanResults

    Returns the result of an instance scan as a single object.

  • InstanceScanPointScan

    Performs an instance scan point scan on a specific record

  • InstanceScanSuiteOnApp

    Performs an instance scan on an application using a specific suite.

  • IsArray

    Returns true if the given value is an array. False if not.

  • IsCamelCase

    Returns true if the given string is "camelCase", false if not.

  • IsDomainSeparationInstalled

    Returns true if domain separtion is installed on the instance. Keep in mind, domain separation may or may not be active.

  • IsEqual

    Checks if two values are equal. The function also supports arrays and can ignore the order of array elements while comparing.

  • IsExistingRecord

    Checks if the given record is really a GlideRecord object representing an existing record.

  • IsInteger

    Returns true if the given parameter is an integer value, returns false if not.

  • IsKebabCase

    Returns true if the given string is "kebab-case", false if not.

  • IsObject

    Returns true if the given value is an object. False if not.

  • IsPascalCase

    Returns true if the given string is "PascalCase", false if not.

  • IsProperty

    Returns true if the given parameter is the name or the sys_id of an existing system property. False if not.

  • IsSnakeCase

    Returns true if the given string is "snake_case", false if not.

  • IsTableCrossScopeAccessible

    Checks if a table is fully cross-scope accessible. The function returns true if the access is set to public and apps from other scopes are allowed to perform read, create, update and delete operations.

  • IsTableDomainSeparated

    Returns true if domain separation is supported and active on a given table, false if not.

  • IsTechnicalUser

    If the given user is a "technical" user, the function returns true, otherwise false.

  • IsTestRunning

    Returns true if the current execution context is an ATF test. False if not.

  • IsUserAdmin

    Returns true if the user is an admin user, false if not.

  • IsUserDefaultAdmin

    Returns true if the user sys_id represents the default OOTB admin user, false if not.

  • IsUserHasRoleExactly

    Returns true of the current user has the provided role explicitly. Returns true if that is the case, returns false if not. If an admin does not explicitly have that role, it will also return false.

  • IsUserSecurityAdmin

    Returns true if the current user is elevated to security_admin, false if not.

  • IsValidColumn

    Returns true of the given table column exists. False if not.

  • IsValidDatabaseView

    Returns true of the given string identifies a database view. False if not.

  • IsValidFunction

    Returns true of the given value is a valid function. False if not.

  • IsValidRecord

    Checks if the given record is a valid glide record object. Returns true if it is, false if not.

  • IsValidSysId

    Checks if the given string is a syntactically correct sys_id. Returns true if it is, false if not.

  • IsValidTable

    Returns true of the given table exists. False if not.

  • IsValidVersion

    Returns true if the given string is a valid version number, false if not.

  • IsVersionCompatible

    Checks if the first version is compatible to the second version - whereas the first version is the version of an installed application and the second version is a requirement.

  • LoadMessages

    Loads all local test messages for an "application".

  • Log

    Produces a log output

  • Merge

    Merges two objects or arrays.

  • ParseCsv

    Parses a csv formatted string into an array of objects representing each row.

  • ParseDateTime

    Parses a string and returns a time value.

  • ParseJson

    Parses a string and returns an object or false in case of failure (instead of pointlessly throwing an exception).

  • ParseUrl

    Parses a URL and returns its components as an object.

  • ParseUrlParameters

    Parses a the URL parameters and returns the parameters as an object.

  • PerformanceQuery

    Measure the average performance of a query in milliseconds from the perspective of a given user based on a defined number of repetitions.
    The result is returned as a JSON object.

  • PerformanceQueryMultiple

    Measure the average performance of a number of queries in milliseconds from the perspective of a number of given users based on a defined number of repetitions.
    The result is returned as a JSON object.

  • ProgressTrackerAPI

    The ProgressTracker class encapsulates the SNC.GlideExecutionTracker object for use within scoped applications.

  • RecordAttachmentAdd

    Adds an attachment to a record.

  • RecordAttachmentDeleteAll

    Delets all attachments of a given record.

  • RecordAttachmentDeleteByFileName

    Delets all attachments of a given record that match a given the file name.

  • RecordBulkProcessor

    A function to process large amounts of records using a callback function. The function makes use of a specified date/time field to determine which record to process next. Multiple instances of a background script can run using this function to work on large amounts of records in a table without interfering with each other.
    For large tables it is imperative to add an index on the date time field!
    If the ghost parameter is set to true, records are updated with setWorkflow(false) to avoid business rules etc. being triggered.

  • RecordDelete

    Deletes a single record from a table. Returns true if the record could be deleted successfully.

  • RecordGetValue

    Shorthand to get a single value from a record from a table based on its sys_id.

  • RecordInsert

    Inserts a new record into a table with the specified values if the columns exist.

  • RecordQuery

    Queries records based on the given values or based on an encoded query. The function will return a record if exactly one record is found, otherwise false.

  • RecordQueryOrInsert

    Queries an existing record based on query values or inserts a new record into a table with the specified values if the record does not exist. The bUpdate parameter controls if the existing record should be updated with the given values or not.

  • RecordSaveToUpdateSet

    Saves the given record to the current Update Set.

  • RecordSetValue

    Sets a single field value on a given record. If bGhost is set to true, no business rules are executed as a result of the update.

  • RedirectToRecord

    Redirects to the form view of the given record if it is valid.

  • RenderBytes

    Returns a user-friendly number of bytes using KB, MB and GB where appropriate.

  • RenderDate

    Renders the given date as an UTC iso string.

  • RenderDateTime

    Renders a date/time value as an UTC ISO string.

  • RenderDateTimeUser

    Renders the given date/time according to the current user's preferences.

  • RenderRecordExecutionSchedule

    Renders the execution schedule for a record (sysauto_script).

  • RenderRecordSummary

    Renders a string with a technical summary of a record including its table name, sys_id, number if available and other text data that can help to identify the record while debugging.

  • RenderTime

    Renders the given time as an UTC iso string.

  • RenderValue

    Render any value as a string. In case of objects, the keys are displayed in alphabetical order. In case of arrays, the elements are displayed in the given order. In case of a GlideRecord, the table name, sys_id and number (if available) are displayed on top, and a selected choice of fields leads the list of values despite the alphabetical order.

  • RenderValueHex

    Render a value as a hexadecimal string.

  • RunScriptInGlobalScope

    Run any script in the global scope even if the context is a scoped application. Note that the script will be placed into a function body so you cannot assume that declared local variables will be valid after its execution. To return a value from the script, set the "result" variable.
    WARNING: Using this function might be considered as a violation of security policies.
    Please make sure any use is based on conscious choice and careful assessment.

  • RunScriptInScope

    Runs any script in any scope even if the context is a scoped application. Note that the script will be placed into a function body so you cannot assume that declared local variables will be valid after its execution. To return a value from the script, set the "result" variable.
    WARNING: Using this function might be considered as a violation of security policies.
    Please make sure any use is based on conscious choice and careful assessment.

  • ScriptEmptyStringLiterals

    Empties all string literals contained in a script (a string).

  • ScriptGetFunctionNames

    Retrieves the names of all functions from the given script (or engine object). As the sn_parser object is only available within a script in a linter scan check, this function can only be used within such a check script for the time being.
    A known deficiency is that anonymous functions erroneously return with the function name of the function that receives the function as a parameter.

  • ScriptRemoveComments

    Removes all comments in a script (a string).

  • SetCurrentScope

    Sets the current scope for the current user's session.

  • SetProperty

    Sets a system property independent of its scope.

  • SetValue

    Sets a value to an object (or array) that is (or is not yet) part of an recursive object (or array) without generating errors if the object (or array) does not exist yet. In case of an array, any preceding elements are added as null if they do not yet exist.

  • Sleep

    Sleeps for the given amount of seconds. This function serves as an alternative to gs.sleep() which is not supported in scoped apps.

  • StartWorker

    The function starts a process worker using the GlideScriptedHierarchicalWorker class in the background and passes all required parameters. Returns the progress id if successful, otherwise false.

  • StopWatch

    The StopWatch class measures time in the same way as a real stopwatch does.

  • StringCheckRegEx

    Checks a given string against a regular expression.

  • StringFind

    Returns the index of the needle string within the haystack string, -1 if the needle is not contained in the haystack.

  • StringFindMultiple

    Returns an array with all indexes of the needle string within the haystack string, Returns an empty array if the needle is not contained in the haystack.

  • StringFindRegEx

    Finds a string in a string based on a regular expression.

  • StringPadStart

    Equivalent of the JavaScript method padStart.

  • StringRemoveCharacters

    The function returns the input string with all characters removed that are contained in the blacklist string.

  • StringReplace

    Replaces all occurences of a string by another string in a string.

  • StringReplaceRegEx

    Replaces all matches of a regular expression by another string in a string.

  • TableSetAttribute

    Sets an attribute of a table to a given value.

  • TestAPI

    The TestAPI class supports scripted tests.

  • TestDataAPI

    A class to create test data records.

  • TimeAddDays

    Adds (or substracts) a given number of days to (or from) a given time value (in milliseconds).

  • TransactionCacheAPI

    A class to manage the transaction cache.

  • UpdateSetDelete

    Deletes an update set including all its files.

  • UserAddRole

    Adds a role to a user if the user doesn't have the role already.

  • UserImpersonate

    Impersonates a user based on a user's sys id.

  • WhatRuns

    Identifies business rules that run for the given tables in the different CRUD operations.

UI Scripts

  • ArrayAppend

    Appends the second given array to the first.

  • ArrayPushUnique

    Adds a value to an arry if it doesn't exist yet. Returns the resulting array.

  • ArrayUnique

    Returns an array with unique values only.

  • ArrayValueExists

    Checks if a value exists in an array and returns true in that case, otherwise false.

  • Clone

    Creates a copy of the given value.

  • Debug

    Produces a debug output.

  • DoModalConfirm

    Displays a modal dialog with "OK" and "Cancel" options. Returns true if the user clicks "OK", false if the user clicks on "Cancel".

  • DoModalMessage

    Displays a modal message dialog.

  • DoModalProgress

    The function encapsulates a glide modal dialog using the "simple_progress_viewer" template. The function renders a progress dialog and triggers an ajax request that starts a worker process.

  • DoModalPrompt

    Displays a modal dialog with with a text input field. Returns the value that is entered by the user.

  • FormatAllFieldsOnPage

    Formats all fields on the page: in the form, related lists or a list view according to the format configuration provided by the backend.

  • FormatValue

    Renders a value based on a given configuration.

  • GetArrayValue

    Returns an array no matter what input type is given and performs necessary conversion if another type is provided.

  • GetBoolValue

    Returns either true or false no matter what kind of value is given.

  • GetCurrentRecordSysId

    Returns the current record's Sys Id. This is either the record being displayed in a form or the record for which the list context menu was opened.

  • GetCurrentRecordTableName

    Returns the current record's table name. This is the record displayed in a form or the record for which the list context menu was selected.

  • GetElementById

    Retrieves an element from DOM by its Id. It uses different methods to get access to the element (including jquery and getElementById) to be functional in different execution contexts (forms, ui pages, etc.)

  • GetFormatConfig

    Retrieves the format config using an ajax request and caches the response to avoid duplicate requests.

  • GetFormatConfigMultiple

    Retrieves the format config for multiple records using an ajax request.

  • GetGlideDialogClass

    Returns the best available class to render a modal Glide dialog pop-up window - if there is any.

  • GetInstanceRecordPath

    Generates a record's path.

  • GetInstanceRecordUri

    Creates the URI for the given record

  • GetIntegerValue

    Returns an integer value.

  • GetKeys

    Returns all key names of an object in an array. Returns an empty array if no object is provided or no members exist.

  • GetParameter

    Retrieves a parameter supplied in the URL.

  • GetStringValue

    Returns a string value in all cases. Arrays and objects are converted into comma separated strings.

  • GetType

    Returns the type of a value.

  • GetValue

    Returns the value of an object that is (or is not) part of an recursive object without generating errors if the object does not exist.

  • HtmlEncode

    Converts a string to html.

  • IdentifyRecordsOnPage

    Identifies all records that are displayed on the current page by iterating over various html elements.

  • Init

    Called when a page is loaded to invoke DevTools features.

  • IsArray

    Returns true if the given value is an array. False if not.

  • IsEqual

    Checks if two values are equal. The function also supports arrays and can ignore the order of array elements while comparing.

  • IsForm

    Returns true if the current page is a form, false if not.

  • IsFunction

    Returns true if the given value is a function. False if not.

  • IsInteger

    Returns true if the given parameter is an integer value, returns false if not.

  • IsList

    Returns true if the current page is a list, false if not.

  • IsObject

    Returns true if the given value is an object. False if not.

  • IsValidSysId

    Checks if the given string is a syntactically correct sys_id. Returns true if it is, false if not.

  • Log

    Produces a log output.

  • Merge

    Merges two objects or arrays.

  • ObserveDOM

    Attaches a listening callback functon to a DOM element.

  • ParseJson

    Parses a string and returns an object or false in case of failure (instead of pointlessly throwing an exception).

  • ParseUrl

    Parses a URL and returns its components as an object.

  • ParseUrlParameters

    Parses a the URL parameters and returns the parameters as an object.

  • RedirectToRecord

    Redirects the browser to the given record - in the same tab/window or a new one depending on the given parameter.

  • RedirectToUrl

    Redirects the browser to the given URL - in the same tab/window or a new one depending on the given parameter.

  • RenderValue

    Render any value as a string. In case of objects, the keys are displayed in alphabetical order. In case of arrays, the elements are displayed in the given order.

  • ServerRequest

    Performs an ajax request (either synchronous or asynchronous) to a defined API and function.

  • SetValue

    Sets a value to an object (or array) that is (or is not yet) part of an recursive object (or array) without generating errors if the object (or array) does not exist yet. In case of an array, any preceding elements are added as null if they do not yet exist.

  • StringRemoveCharacters

    The function returns the input string with all characters removed that are contained in the blacklist string.

Test step configurations

DevTools contains the following customized test step configurations:

Extension Points

  • DevTools

    The DevTools extension point allows to extend some DevTools features.

    var DevTools = Class.create();
    DevTools.prototype = {
    	initialize: function()
    	{	
    	},
    
    	GetParentRecord: function(grRecord)
    	{
    		var IsValidFunction = x_snc_devtools.IsValidFunction;
    		if (IsValidFunction(x_this_app_scope.DevToolsGetParentRecord))
    		{
    			return DevToolsGetParentRecord(grRecord);
    		}
    		return false;
    	},	
    
    	GetLinkDirectory: function(linkdirectory)
    	{
    		var IsValidFunction = x_snc_devtools.IsValidFunction;
    		if (IsValidFunction(x_this_app_scope.DevToolsGetLinkDirectory))
    		{
    			return DevToolsGetLinkDirectory(linkdirectory);
    		}
    		return linkdirectory;
    	},
    
    	GetFormatConfig: function(grRecord)
    	{
    		var IsValidFunction = x_snc_devtools.IsValidFunction;
    		if (IsValidFunction(x_this_app_scope.DevToolsGetFormatConfig))
    		{
    			return DevToolsGetFormatConfig(grRecord);
    		}
    		return false;
    	},	
    
    	
    	type: 'DevTools'
    };

Business Rules

License

Copyright 2020-2022 by Sascha Wildgrube

Licensed under the Apache License, Version 2.0 (the "License")

You may not use DevTools except in compliance with the License.

You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Release Notes

1.48.0 - 2022-11-30

  1. Added function IsTestRunning() and added required logic to TestAPI.
  2. Added UI script function IsFunction().
  3. Function InstanceScanSuiteOnApp() now sets the user that actually triggered the scan in the result record (instead of the technical user that is used to trigger the REST API call).
  4. UI script function DoModalProgress() now also supports callbacks for the case the process could not be started and for status updates.
  5. Added ATF test for function HtmlRenderScriptUrl().

1.47.0 - 2022-11-28

  1. Added function StringReplaceRegEx().
  2. Added function ScriptEmptyStringLiterals().
  3. Added function ScriptRemoveComments().
  4. Added function InstanceScanSuiteOnApp().
  5. Added function InstanceScanSuiteOnApp() to the DevToolsClientAPI class.
  6. Added function GetCurrentScope().
  7. Added class ProgressTrackerAPI (which does not yet work properly).
  8. Added class DevToolsWorkerAPI to contain proxy lengthy operations functions that can be executed through a progress worker.
  9. Added UI script function GetParameter().
  10. Added UI script function RedirectToUrl().
  11. Added UI script function RedirectToRecord().
  12. Added UI script function GetInstanceRecordUri().
  13. Added UI script function GetInstanceRecordPath().
  14. Added UI script function GetElementById().
  15. The function InstanceScanGetScanResults() now reflects the given result record Sys ID in the result object.
  16. Added business rule on sys_app to set the user's current scope to the scope of the app that is displayed.
  17. Added business rule on sys_app to set the repo url to the currently configured repo url (if it exists and no repo url has been set in the app yet).
  18. The current scope is now automatically set to the scope of the system properties category when a user navigates to the system_properties_ui page.
  19. The UI action "Find Sys ID" now opens a new tab.
  20. Added the version column in the DevTools view for table sys_app.
  21. The menu module "Applications" now links to the sys_app table.
  22. Added menu module "UI Scripts".
  23. Added "DevTools" views for Script Includes and UI Scripts.
  24. Added "System Log" to the menu.
  25. Added table sys_execution_tracker to the link directory.
  26. Added ATF for function Sleep().
  27. Added ATF for function HtmlRenderScript().
  28. Removed not needed debug log output from various UI scripts.

1.46.0 - 2022-11-14

  1. Tokyo is now supported.
  2. Added function IsInteger().
  3. Added function HtmlRenderTable().
  4. Added function HtmlRenderStyle().
  5. Added function RenderRecordExecutionSchedule().
  6. Added function DocumentationAPI::RenderScheduledJobs().
  7. Added UI script function IsInteger().
  8. Fixed a bug in TableSetAttribute() which may have caused the wrong dictionary record to be changed.
  9. Function and UI script function SetValue() can now handle arrays, too.
  10. ATF test step configuration "DevTools - Check scoped app dependency" now strips whitespaces from the version list.
  11. ATF test "DevTools - GetAllTables" now produces less output to not run into memory issues.
  12. Removed Rome support from the manual UI page template.
  13. Added DevTools website url to the manual UI page template.
  14. UI action "Baseline" - i.e. the function AppVersionBaseline() - is now also executing the AppSanity() function for the app.
  15. AppBuilder() now adds x_snc_devtools.AppInstall() to the created AppInstall() function to show how apps can also install their dependencies.

1.45.0 - 2022-11-01

  1. Added function GetAllTables() to get details on all tables (including their extension hierarchy if requested).
  2. Added function DevToolsClientAPI::GetAllTables() so that GetAllTables() can be called from the client.
  3. Added function IsCamelCase() to check if a string is "camelCase".
  4. Added function IsKebabCase() to check if a string is "kebab-case".
  5. Added function IsSnakeCase() to check if a string is "snake_case".
  6. Added function GetCleanAppName() to strip postfixes from an application name based on the given string and refactored GetAppName() to use the new function.
  7. Added function GetInstanceListURL().
  8. Added function ScriptGetFunctionNames() to get a list of all functions contained in a script (represented by a linter scan check engine object).
  9. Added business rule "sys_flow_context - Set domain" to fix the issue described in KB0998966.
  10. Function GetAppRecord() can now also get the app record by the (clean) name of the app.
  11. Function GetAppRecord() can now also be used to get store apps, since it now queries the sys_scope table (instead of sys_app).
  12. Function GetAppScope() now uses GetAppRecord() internally and hence can return the scope name based on an app's Sys ID, name, scope name or an existing record object.
  13. Function RenderRecordSummary() now also considers the title column.
  14. Function DocumentationAPI::RenderInstallationInstructionsImportFromSourceControl() now also renders a link to the application's installation instructions if required.
  15. Added "List" and "All Configurations" links to the WhatRuns page.
  16. Added the "Maintainer", "Maintainer Email", "Documentation (url)" and "Repository (url)" fields on sys_app.
  17. Added the DevTools view for sys_app to only show essential fields and the new fields to document the maintainer, documentation and repo urls.
  18. Fixed a bug in client function ServerRequest().
  19. Fixed a bug in function RecordSetValue() that prevented the ghost parameter to work properly.
  20. GetParentRecord() and the "Up" UI action now support records in sys_atf_test_suite_test and return the related sys_atf_test_suite record.
  21. The application system property x_snc_devtools.ui.force_scope can now be used to control if the user's current scope should be forced to the record scope when loading a form.
  22. Enforcing the DevTools view on the content_css form and make sure only the correct fields are displayed.
  23. Added tables sys_scope, sys_app, sys_metadata, sys_number and sys_number_counter to the link directory.
  24. Added tables sc_catalog, sc_cat_item and sc_category to the link directory.
  25. Added table sys_ui_form to the link directory.
  26. Added new section on cross-scope scripting in the manual.

1.44.0 - 2022-09-18

  1. Added function HtmlRenderScriptUrl().
  2. Added function HtmlRenderWarning().
  3. Added function HtmlRenderInfo().
  4. The message rendered by HtmlRenderError() now looks like the usual ServiceNow error message.

1.43.0 - 2022-09-17

  1. Added function GetVariablesFromRecord().
  2. Added function SetCurrentScope().
  3. Added function HtmlRenderError().
  4. Added function HtmlRenderScript().
  5. Added function IsPascalCase().
  6. Added function DocumentationAPI::RenderEditorMacros().
  7. Function GetTableFromSysId() is now public and hence added to the manual.
  8. Function GetPseudoSysId() is now public and hence added to the manual.
  9. Function GlideRecordAddQuery() is now public and hence added to the manual.
  10. Added UI script function DoModalMessage() to display a message in a modal dialog.
  11. Added UI script function DoModalConfirm() to ask the user for confirmation using a modal dialog.
  12. Added UI script function DoModalPrompt() to ask the user for a text input using a modal dialog.
  13. Added UI script function GetGlideDialogClass().
  14. Added UI script function HtmlEncode().
  15. Added a widget dependency and JS includes to use the DoModal* functions in portal widgets.
  16. Added table sys_ui_action_view to the link directory.
  17. Added tables sys_ws_definition and sys_ws_operation to the link directory.
  18. Added tables sc_item_option and sc_item_option_mtom to the link directory.
  19. Added business rule on sys_metadata to set the user's current scope to the scope of the record that is displayed.
  20. The "Save" UI action is now aware of the limitations to define a UI Action View (rule) in one scope referring to a UI Action from a different scope and displays the background script workaround.
  21. GetParentRecord() and the "Up" UI action now support records in sys_ui_action_view and return the related sys_ui_action record.
  22. GetParentRecord() and the "Up" UI action now support records in sc_item_option and sc_item_option_mtom and return the related records.
  23. GetParentRecord() and the "Up" UI action now support records in sys_ws_operation and returns the sys_ws_definition record.
  24. Added macro for AppBuilder().

1.42.0 - 2022-08-11

  1. Added UI action "Parent Table" to navigate from a list view to the parent table list view (if the table has a parent).
  2. Added function StringFindMultiple() to get all the indexes of all occurences of a needle string in a haystack string.
  3. Added function GetStackTrace() to get the raw stack trace as a string.
  4. Added function GetCallStack() to get the call stack in a structured format.
  5. Added function GetScriptRecord() to get the record that contains the script from which GetScriptRecord() is called.
  6. TestAPI::TestCase_InstanceScanCheck() now outputs the record summary for the test case.
  7. RenderValue() now supports the bCompactOutput parameter which uses RenderRecordSummary() for GlideRecord objects.
  8. GetParentRecord() and subsequently the "Up" UI action now support records in derived tables.
  9. GetParentRecord() now supports records in sys_metadata and returns the scope/app record.
  10. TestAPI::TestCase() now supports the bCompactOutput parameter which uses RenderRecordSummary() for GlideRecord objects.
  11. RenderRecordSummary() shows the api_name for sys_script_include records.
  12. Added UI script functions IsForm() and IsList().
  13. Added UI script functions GetCurrentRecordTableName() and GetCurrentRecordSysId().
  14. Added sys_ux_theme and cmn_cost_center tables to the link directory.
  15. Debug output is now prefixed by "DEBUG". The "Debug Log" module now ONLY shows debug output.

1.41.0 - 2022-07-19

  1. Added function RecordSaveToUpdateSet() and updated the UI action "Baseline version" to make use of it.
  2. Added function GetPseudoSysId() to get a VERY unlikely but valid Sys Id for testing purposes.
  3. Added table db_image, sys_ux_client_script, sys_ux_client_script_include to the link directory.
  4. Added tables from package "Product Inventory Advanced" to the link directory.
  5. ATF test "DevTools - HtmlRenderImage" is now using an image that is shipped with the DevTools application.

1.40.0 - 2022-07-07

  1. RedirectToRecord() now supports the view parameter.
  2. Added UI action "Show Table Dictionary Record".
  3. Added UI action "Baseline Version" to support the baseline of an application version.
  4. UI action "Save" now maintains the current view.
  5. UI action "Up" now maintains the current view.
  6. UI action "List" maintains the current view.
  7. GetParentRecord() now supports cmn_location, sys_ui_related_list and sys_ui_related_list_entry.
  8. TestDataAPI now supports Service Portal widgets.
  9. Added sp_page and sp_widget to the link directory.

1.39.0 - 2022-06-11

  1. Added function GetParam() to get a url parameter in different contexts.
  2. Added function HtmlRenderImage() to render an image stored in db_image into an html document.
  3. Added function GetScopeSysIdFromPropertyName() to identify the scope of a system property based on its name - no matter if the property actually exists or not.
  4. Added function GetInstanceListURI() to return a list view uri for a given table.
  5. Added function InstanceScanPointScan() to run a synchronous point scan on a record.
  6. Added function InstanceScanGetScanResults() to return the results of an instance scan in a single object.
  7. Added UI action "Show Choices" to show the choices associated to a table.
  8. SetProperty() and InstallerAPI::SetProperty() are now using GetScopeSysIdFromPropertyName() to identify the right scope when creating a system property.
  9. Added function TestAPI::TestCase_InstanceScanCheck().
  10. TestDataAPI now supports script includes.
  11. AppInstall() now makes the field class "Related Tags" visible.
  12. AppBuilder() now creates the system property "logging.verbosity" for the application and the created AppSetDefaults() functions sets the property to "info" by default.
  13. The "Save" UI action no longer shows on the "Many to Many Definition" form.
  14. GetParentRecord() can now properly handle sys_choice records that refer to sys_dictionary entries of a parent table.
  15. The manual template now longer contains Quebec as a supported platform version.
  16. Added table sys_filter_option_dynamic to the link directory.
  17. Added tables label and label_entry to the link directory.

1.38.0 - 2022-05-31

  1. Quebec is no longer actively supported.
  2. Added function InstanceReset() to remove questionable OOTB features. Handle with care!
  3. Added function CacheFlushMenu() to update the navigation menu.
  4. Added function StringFind() to encapsulate .indexOf and correct its faulty behavior with empty strings.
  5. Added function StringFindRegEx() to search for a string using a regular expression.
  6. Added function IsUserDefaultAdmin() to check a given sys_id against the OOTB default admin user sys_id.
  7. Added UI script function GetBoolValue().
  8. Added UI script function RenderValue().
  9. Added UI script function StringRemoveCharacters().
  10. Added UI script function ParseUrl().
  11. Added UI script function ParseUrlParameters().
  12. WhatRuns() now supports flows which are triggered on insert or update a record in the given table.
  13. GetAppName() is now using GetAppRecord() internally and hence accepts both the Sys ID and the scope name as input.
  14. InstallerAPI class now accepts a paramter to specify a context string used in log output.
  15. InstallerAPI now flushes the menu cache after installation.
  16. Added InstallerAPI::ActivateServicePortal() to control if a given Service Portal should be accessible.
  17. Added InstallerAPI::ActivateModule() to control if a given menu Module should be visible.
  18. Added InstallerAPI::ActivateAppMenu() to control if a given Application Menu should be visible.
  19. Added InstallerAPI::RecordSetValue() to set a single field in a given record to a new value.
  20. InstallerAPI::SetTableAttribute() now respects that an installation is aborted.
  21. AppBuilder() now uses the new context parameter of InstallAPI when creating the AppInstall() function script include.
  22. Clone() is now explicitly considering arrays - this addition was necessary due to a bug in the ServiceNow Javascript engine where arrays are unintendedly stored as references in objects.
  23. UI script ServerRequest is now properly returning false as a result of the callback function.
  24. Added Flow Designer tables sys_hub_flow and sys_flow_trigger to the link directory.
  25. Added tables pa_dashboards, pa_tabs, pa_dimensions and sys_ux_data_broker to the link directory.
  26. Added an ATF test for InstallerAPI.

1.37.0 - 2022-04-19

  1. Added function GetCountryRecord().
  2. Added function StringCheckRegEx().
  3. Added UI script function GetIntegerValue().
  4. GetParentRecord() and the "Up" UI action now support records related to the Release Management plugin.
  5. Added Release Management related tables to the link directory.
  6. Added tables sys_ui_policy, sysrule_view to the link directory.
  7. WhatRuns() now supports view rules.
  8. AppBuilder() now sets the order for the manual ui page correctly behind the menu separator.
  9. AppInstall() now disables the specific "Save" UI action on table rm_story if it exists to avoid duplicate buttons.
  10. DocumentationAPI::RenderInstallationInstructionsImportFromSourceControl() now supports the additional parameter bAdditionalSteps to control if the reader should be advised to perform additional steps during installation that are documented for the given app.

1.36.0 - 2022-04-08

  1. San Diego is now supported.
  2. Added function CreateQRCodeRawData() to generate the raw data for a QRCode.
  3. Added function WhatRuns() to identify which business rules run on a table for the different CRUD operations - currently supporting insert, update and query. A corresponding UI action has also been added on forms and lists.
  4. Added function HtmlRenderQRCode() to render a QR code as plain vanilla html.
  5. Added the ImageAPI class to craft wonderful images and render them as plain html code or bmp files.
  6. Added function GetAppRecord() to get a record object of an app either by its Sys ID or its scope name.
  7. Added function HtmlRenderValue() to output any value into an html document.
  8. Added function RenderValueHex() to render a value as an hexadecimal string.
  9. Added function StringReplace() to replace strings in strings.
  10. Added function CreatePDFFromHtml() to render a pdf file based on html and add it as an attachment.
  11. Added function RecordAttachmentAdd() to add an attachment to a given record.
  12. Added function RecordAttachmentDeleteAll() to delete all attachments of a given record.
  13. Added function RecordAttachmentDeleteByFileName() to delete all attachments that match the given file name of a given record.
  14. Added function RenderTime() to render a date time value as an UTC ISO string.
  15. Added UI script function IsValidSysId() - however the function does not yet support currencies.
  16. GetTableFromSysId() is now using cross-scope techniques to identify records in the various tables - avoiding errors caused by cross-scope restrictions.
  17. DocumentationAPI::RenderListItem() now checks the text parameter properly and does not show "null" if the text is not provided.
  18. InstallerAPI::SetProperty() now creates a property if it does not exist yet.
  19. SetProperty() now supports the bAdd parameter to control if a non-existing system property should be created. New system properties are created in the global scope.
  20. AppInstall() now sets the system property "sn_g_app_creator.allow_global" to true to allow users to create global scoped applications.
  21. AppInstall() now unhides the "Email" field class so that it can be used by developers.
  22. Added tables sys_ux_form_action, sys_ui_page and sys_public to the link directory.
  23. Added tables from the "Data Model for Order Management" plugin to the link directory.
  24. The test step configuration "DevTools - Check scoped app sanity" now checks for system properties which do not have the scope name as a prefix.
  25. Test step configuration "DevTools - Check scoped app sanity" now checks for empty description fields in roles.
  26. The manual template used by AppBuilder() is now also including documentation of contained roles.
  27. The "debugrecord" macro is now producing code that works from other scopes, too.
  28. The "List" button now saves the current record before navigating to the list view.
  29. The "Find Sys ID" UI action now provides feedback if an invalid Sys ID was provided.
  30. When using AppBuilder() to built new apps, the bootstrapped manual ui page now also contains instructions to load the app from a source control repository.
  31. The ATF test "DevTools - Implementation" now checks for any UI view that starts with "exp_dtemp" in the DevTools scope explicitly.
  32. Refactoring of code to avoid the [0] anti-pattern.

1.35.0 - 2022-03-15

  1. Added security warnings to the manual and the documentation and source code of function RunScriptInScope() and RunScriptInGlobalScope().
  2. HtmlRenderLinkDirectory() now supports the title value in the link directory.
  3. GetParentRecord() now supports scan_check and its derived record classes.
  4. Added tables cmn_location item_option_new, item_option_new_set and sc_item_variables_task to the link directory.
  5. Added instance scan related tables to the link directory.
  6. Added script editor macro "debugrecord" to add code that renders a record summary into the debug log.
  7. More evaluator errors are filtered out in the "Evaluator Log" module which are caused by OOTB components.

1.34.0 - 2022-02-24

  1. Added table sys_documentation to the link directory.
  2. RunScriptInScope(), IsValidTable(), IsValidColumn(), GetParentTable() and IsUserHasRoleExactly() now use the transaction cache to avoid repetitive database queries.
  3. IsUserHasRoleExactly() has been optimized to determine the user role in one query.
  4. PerformanceQuery() no longer defaults to the current user of no or an invalid user was specified. In such cases it will return false.

1.33.0 - 2022-02-17

  1. Added function IsDomainSeparationInstalled() to determine if the domain separation plugin is installed.
  2. Function GetArrayValue() now works properly on GlideRecord fields (which are objects of type ScopedGlideElement).
  3. Added tables related to "Automated Testing Framework" to the link directory.
  4. Added domain separation related tables to the link directory.
  5. Added tables related to "Asset Lifecycle Management" to the link directory.
  6. The table ast_contract is now under "Contract Management" in the link directory.
  7. The tables sys_app and sys_plugin have been removed and the table sys_package has been added under "Apps" in the link directory.
  8. Added tables related to "Customer Service Management" to the link directory.
  9. Added tables related to "Product Catalog Management" to the link directory.
  10. Added tables related to "Customer Service Install Base Management" to the link directory.
  11. Added tables related to "Order Management for Telecommunications" to the link directory.
  12. Added catalog_script_client table to the link directory.
  13. Business rule "sys_script_client - set table to global" now only acts on Client scripts (and not on derived tables like "Catalog Cliient Scripts")
  14. Function IsTableDomainSeparated() no longer requires the sys_domain_path column to be present in a table.
  15. Function GetAppName() now also removes a " HOTFIX" postfix.
  16. The "Start" page has been renamed to "Manual".
  17. DocumentationAPI::RenderLicense() did not use the application name (was displaying "DevTools" instead). This has been fixed.

1.32.0 - 2022-01-28

  1. Added tables sys_index, sys_ui_bookmark_group and sys_ui_bookmark to the link directory.
  2. GetTableFromSysId() now ignores tables starting with "sn_esign_".
  3. The global system property "glide.script.block.client.globals" is now created during installation if it does not exist yet.
  4. Test step configuration "DevTools - Check scoped app sanity" now checks for an empty description field in system properties.
  5. Test step configuration "DevTools - Check scoped app sanity" no longer objects records in sys_index associated to the app.
  6. IsTableDomainSeparated() did not work properly if the domain separation system property does not exist. This has been fixed.
  7. The "Create Macro" UI action produced incorrect source code. Syntax editor macros for TimeAddDays(), IsTableDomainSeparated() and AppGetScope() were created incorrectly. This has been fixed.
  8. Added chapter "Service Portal Deactivation" to the documentation.

1.31.0 - 2022-01-13

  1. Paris is no longer actively supported.
  2. Introduced the Field Formatting Feature to display float values nicely in forms and lists.
  3. Control whether a Service Portal is active by setting the 'Active' flag on records in sp_portal.
  4. Added function TimeAddDays() to add a number of days to a given numeric time value.
  5. Added function SetValue() to set a value in a recursive object.
  6. Added function ArrayPushUnique() to add a value to an array if it doesn't exist yet.
  7. Added function GetAppScope() to get the scope name of an application based on its Sys Id.
  8. Added function IsTableDomainSeparated() to check if domain separation is active and supported on a given table.
  9. Merge() now also merges arrays including arrays within nested objects.
  10. Function GlideRecordInsert() now also supports the ghost mode in which it avoids the execution of business rules during insert.
  11. Added UI Script function ObserveDOM() to attach an oberving callback function to a DOM element.
  12. Added UI Script function ServerRequest() to make an Ajax API call to a server-sided script include class.
  13. Added UI Script functions Log(), Debug(), GetType(), IsEqual(), IsObject(), IsArray(), ArrayPushUnique(), ArrayValueExists(), GetKeys(), GetArrayValue(), ParseJson(), Merge(), Clone(), GetValue() and SetValue() which are equivalent to their server-sided script include counterparts.
  14. Added method InstallerAPI::ActivateUiPolicy() to set an existing UI Policy active or inactive during installation.
  15. RecordBulkProcessor() is now aware of lengthy record processing and multiple scheduled jobs running in parallel.
  16. DocumentationAPI::RenderRoles() now renders links to the role record pages.
  17. Added business rule "sys_script_client - set table to global" to allow global Client Scripts. OOTB the option of defining global Client Scripts is disabled. This business rule fixes this issue by setting an empty table field to "global".
  18. HtmlEncode() now also converts new line characters to line break html tags.
  19. Test "DevTools - CurrencyConversion" failed if the instance was set up after september 2021 as ECB exchange rates are not loaded historically. The test now uses the default rate supplied in an OOTB instance.
  20. Test step configuration "DevTools - Check scoped app sanity" now checks if a sys_ui_script has a description.
  21. Added tables sp_portal, sys_script_client, sys_ui_script and fx_system_rate to the link directory.
  22. Link to table sys_app_application in the link directory did not work. This has been fixed.
  23. Hardened CurrencyConversion() against invalid parameters.
  24. The new form link UI action "Create Macro" on the script include form helps to create a syntax edit macro to access a function or class defined in that script include.
  25. The global "Save" button is now ONE UI Action for both insert and update operations.
  26. AppBuilder() had a defect that cause the IsActive() function in the target application not to work correctly. This has been fixed.
  27. InstallerAPI.SetProperty() was defective and did not set properties correctly. This has been fixed.
  28. The AppInstall() script now also sets the system property "glide.script.block.client.globals" to false to enable global client-sided scripts and hence all client-side DevTools capabilities.
  29. Added system property "logging.verbosity" to control DevTools log output. Debug() is now using gs.debug() to produce debug output. AppInstall() sets "logging.verbosity" to "debug" which is the default setting.

1.30.0 - 2021-12-08

  1. Added function StringPadStart() to compensate the missing Javascript function padStart.
  2. Added function RenderDate() to render the given date/time as an UTC iso string.
  3. Added function RenderDateTimeUser() to render the given date/time according to the current user's preferences.
  4. GetRecord() now checks if the given table actually has the sys_id column and returns false if not.
  5. GetTableFromSysId() ran into errors when trying to search fenced tables like sn_hr_* and sn_doc_*. These tables are now ignored.
  6. IsUserHasRoleExactly() did not work correctly of no user sys_id was specified (which should imply to assume the current user). This has been fixed.

1.29.0 - 2021-12-07

  1. AppBuilder() now creates a manual page based on a template. A perfect start for app documentation.
  2. Added function DocumentationAPI::RenderInstanceScanChecks() to document instance scan checks contained in the app.
  3. IsValidVersion() now considers version numbers consisting of four components as valid.
  4. GlideRecordQuery() does not work on table sys_app_module. A fix is implemented. This has caused the AppBuilder() function to create duplicates of application menu modules.
  5. GlideRecordAddQuery() was defective when using an encoded query string. This has been fixed.
  6. HtmlRenderLinkDirectory() now supports query, order and order_direction parameters in the link directory.
  7. Tables sys_app_module and sys_app_application have been added to the link directory.
  8. GetParentRecord() now also supports sys_app_module and sys_choice.
  9. Added InstallerAPI::RecordInsertOrUpdate() to add and/or update records during installation in a generic and flexible way.
  10. AppBuilder() produced a defective AppInstall() function. When creating the InstallerAPI object, the DevTools scope was missing. This has been fixed.
  11. Removed the "Event" section from the DevTools menu because all relevant links are now contained in the link directory.
  12. Removed the outdated security notice from the documentation.

1.28.1 - 2021-12-02

  1. Improved the rendering of the link directory.
  2. Fixed a defect in AppBuilder() that prevented creating the "Log" module properly.

1.28.0 - 2021-12-01

  1. Added function RecordQueryOrInsert() to retrieve a record based on a set of criteria and create the record if it doesn't exist using a set of given values.
  2. Added function RecordQuery() to retrieve exactly one record based on the given query object or string. Returns false if no record is found or the criteria identify multiple records.
  3. Added function GlideRecordSetValues() to set multiple values on a GlideRecord object at once.
  4. Added function CurrencyConversion() to convert a monetary amount from one currency to another.
  5. Added function GetFloatValue() to convert a given value into a floating point number.
  6. Added GetProperty() to receive the value of a system property using its defined type.
  7. Added GetDateNow() to return the current date (UTC) as an ISO-formatted string.
  8. Added the global "Save" button and the system property x_snc_devtools.ui.save_button to control its visibility.
  9. Function TestDataAPI::GetAllUsers() now also provides the groups of a user.
  10. Function TestDataAPI::GetAllGroups() now also provides the users of a group.
  11. Added function DocumentationAPI::RenderUIScripts() to auto-document UI scripts contained in an app and added the chapter in the DevTools documentation.
  12. Added function TestDataAPI::GetAllConfigurationItems().
  13. IsValidSysId() now also supports currency codes as they are used as sys_ids in fx_currency.
  14. Test step configuration "DevTools - Check scoped app sanity" now checks if a sys_app_module title matched the sys_name and AppSanity() fixes that in case it is required.
  15. Tables sysevent_register, sysevent_email_action, sys_script_email, sys_properties_category, sys_properties_category_m2m, var_dictionary, sys_variable_value, sys_ui_style, sys_dictionary_override, fx_rate, sys_decision, sys_decision_input and sys_decision_question have been added to link directory.
  16. GetParentRecord() now also supports sys_ui_style, sys_dictionary_override, fx_rate, sys_decision_input and sys_decision_question.
  17. AppBuilder() now also adds a test suite and a module in the application menu.
  18. AppBuilder() adds test "Implementation" and "Installation" to the app's test suite.
  19. AppBuilder() creates application menu module "Log".
  20. Fixed a defect in RedirectToRecord() that should have prevented the function from working at all (which it didn't).
  21. RenderValue() no longer produces an error when a JavaObject is used as the parameter. However it cannot render it properly.
  22. Removed Debug*() and Log() functions from TransactionCacheAPI and TestDataAPI classes.

1.27.1 - 2021-11-19

  1. A defect prevented the "Find Sys ID" UI action to be visible. This has been fixed.

1.27.0 - 2021-11-18

  1. Added function RedirectToRecord() to redirect the user agent to the given record.
  2. Added function ParseCsv() to convert a string containing csv formatted data into an array of objects representing the data rows.
  3. HttpRequest() now supports headers and sending a request body.
  4. Test step config "DevTools - App sanity" now checks if test steps' copied_from fields are empty.
  5. AppSanity() function now also accepts a scope name.
  6. AppSanity() now also clears all test steps' copied_from fields.
  7. GetParentRecord() now supports sys_ui_policy_rl_action, sys_ui_policy_action, sys_ui_policy, sys_ui_section, sys_ui_element, sys_ui_list and sys_ui_list_element.
  8. Added cmdb_rel_type, sys_ui_policy_rl_action, sys_ui_policy_action, sys_ui_policy, fx_currency, sys_glide_object, sys_ui_section, sys_ui_element, sys_ui_list and sys_ui_list_element to GetLinkDirectory().
  9. AppBuilder() creates the script include for the AppInstall() function.
  10. AppBuilder() creates the "active" system property.
  11. AppBuilder() creates the "log.active" system property und the Log() function respects if the property is set to true.
  12. AppBuilder() creates the script include for the IsActive() function.
  13. AppBuilder() creates the script include for the AppGetProperty() function.
  14. HtmlRenderLinkDirectory() now also renders links specified directly using a url.
  15. TestDataAPI::CreateRequestTask() now uses the third paramter as the opened_by user instead of the assigned_to user for consistency.
  16. Added function InstallerAPI::ShowFieldClass() to show or hide a field class during installation.
  17. GetTableFromSysId() has been improved significantly. Various tables are excluded and tables are searched in a way that makes it more probably that records are found faster.
  18. AppInstall() now unhides the "UI Action List" field class so that it can be used by developers.

1.26.0 - 2021-11-10

  1. Added the new "Links" page with the new link directory with many useful links for admins and developers. The new function GetLinkDirectory() returns the standard DevTools link directory. The directory can be extended using the DevTools extension point.
  2. Removed the "Access Control" sub menu and the "Cross Scope Privileges" module.
  3. Added function RecordInsert() to add a new record into a table with a given set of values.
  4. Added function RecordGetSummary() to render a short hand summary of a record for debugging.
  5. Added function IsExistingRecord() to check if a given GlideRecord object represents an existing record.
  6. Added functions TestAPI::Get*() to get the Sys ID of the corresponding test data item.
  7. Added function TestAPI::TestCase_GetRecord() to check if a record exists.
  8. Added function TestAPI::TestCase_RecordGetValue() to check the value of a field in a given record.
  9. Added function TestAPI::TestCase_IsRecordAccessibleByUser() to check if a given user has access to a given record.
  10. Added function GetInstanceListPath() to generate the path component to access a list view.
  11. Added function HtmlRenderLink() to render the html for a link.
  12. Added function IsUserAdmin() to check if the current or a given user has the admin role.
  13. Added function GetShortUniqueString() to render unique strings and avoid naming collisions.
  14. Added function ParseURL() to return the components of a url in an object.
  15. Added function ParseUrlParameters() to return the key value pairs of a url parameter string in an object.
  16. Added method InstallerAPI::ActivateUiAction() to set an existing UI Action active or inactive during installation.
  17. Added support for core_comapany and ast_contract in TestDataAPI class.
  18. Added function GetRoleNamesFromUser() to get the names of the active roles of a user.
  19. Functions IsUserSecurityAdmin() and IsUserHasRoleExactly() now support a parameter to specify a user to check.
  20. The new UI Action "Find Sys ID" asks the user for a sys id and then redirects the browser to the record form page. That's a real killer feature!
  21. The new UI Action "Execute Now" replaces the OOTB "Execute Now" UI Action on sysauto_script. It triggers the execution, stays on the current form and displays a message that the job has been triggered for execution.
  22. AppInstall() now deactivates the OOTB UI action "Execute Now" on sysauto_script.
  23. TestAPI::TestCase() now uses strict comparison ("===") when comparing the expected value with the result. Affected tests have been adapted accordingly.
  24. GetTableFromSysId() now checks if the sys_id field exists before trying to find the record - thus making the process faster and more robust.
  25. GetTableFromSysId() checks the sys_package, domain, core_company and ast_contract tables first to cover more of the more likely use cases without doing the full scan through all tables.
  26. IsTechnicalUser() now checks parameters against invalid and empty values and returns false if there are multiple technical users sharing the same user_name.
  27. GetParentRecord() now supports sys_storage_alias.
  28. AppBuilder() now also creates the script include for the AppSetDefaults() function.
  29. AppBuilder() now checks if an application menu already exists.
  30. AppBuilder() now creates the extention point instance for the DevTools extension point and the corresponding script includes.
  31. Updated example script for the DevTools extension point.
  32. The "List" button now keeps the filter of the list view from which the current record form was navigated.
  33. The "Delete Update Set" button is now active by default.
  34. Sleep() is now accessible to all application scopes.
  35. Renamed function DeleteUpdateSet() to UpdateSetDelete() and made it accessible to all scopes.
  36. The test step config "DevTools - Check scoped app sanity" now checks if active UI actions have a description (a non-empty comments field).

1.25.0 - 2021-10-11

  1. RunScriptInGlobalScope() and the new RunScriptInScope() functions no longer require configuration changes on the sys_script_include table. If DevTools has been installed in the past you may use the following script to revert the modified configuration back to OOTB:
    var grRecord = new GlideRecord('sys_db_object');
    grRecord.addQuery('name','=','sys_script_include');
    grRecord.query();
    if (grRecord.next())
    {
       grRecord.access = '';
       grRecord.read_access = 'true';
       grRecord.create_access = 'false';
       grRecord.update_access = 'false';
       grRecord.delete_access = 'false';
       grRecord.update();
    }
    gs.invalidateCache();
  2. Added function GetTableFromSysId() to identify the table of the record identified by the given sys_id.
  3. Added function ArrayAppend() to append an array to another and make sure return value is always an array.
  4. Added function DatabaseIndexCreate() to add a new database index.
  5. Added function GetParentTable() to return the name of the super class of a given table.
  6. Added function IsValidColumn() to check if a given column exists in a table (or its parent tables).
  7. Added function IsValidFunction() to check if the given value is a callable function.
  8. Added function RecordGetValue() to get a single value from a given record.
  9. RecordSetValue(), GlideRecordUpdate() and RecordBulkProcessor() now support the ghost parameter which (if set to true) uses setWorkflow(false) and autoSysFields(false) to supress business rules, auditing and sys field updates.
  10. RecordBulkProcessor() now effectively detects if the same record is found again and again to prevent an endless loop. If a business rule prevents the update of a record and the ghost mode is not set, the function returns immediately.
  11. Added function TableSetAttribute() to set an attribute of a table to a given value.
  12. Added method InstallerAPI::SetTableAttribute().
  13. Added method InstallerAPI::ActivateBusinessRule().
  14. Added method InstallerAPI::ActivateClientScript().
  15. Added function DeleteUpdateSet() function and the "Delete Update Set" UI action. A system property controls if the button is available to admin users.
  16. The DevTools AppInstall() function now sets the update_synch attribute of the sysauto_script table to true to make sure that scheduled jobs are captured in update sets and committed to source control.
  17. AppInstall() now enables the creation of cross-scope before query business rules by deactivating a business rule and two client scripts.
  18. AppInstall() modifies the UI action "Execute Now" on sysauto to stay on the current form.
  19. The function TestAPI::TestCase() now displays the milliseconds required to run the given function.
  20. Test "DevTools - RunScriptInGlobalScope - Temporary script includes" was flaky due to race conditions during test executions. Added a threshold of 30 minutes so the test will only alert on left over script includes created more than 30 minutes ago.
  21. Test "DevTools - Installation" now checks if the sysauto_script table is configured so that records are captured in update sets and committed to source control.
  22. Test step configuration "DevTools - Check scoped app sanity" now checks for unwanted entries in sys_index associated with the app.
  23. Test step configuration "DevTools - Check scoped app sanity" now checks for test suite tests where the scope of the record does not match the scope of the associated test suite.
  24. Added the business rule "sys_atf_test_suite_test - match scopes" to make sure a test suite test is using the same scope as the associated suite.
  25. GetParentRecord() is now more effectively checking for the suite most relevant to a test by considering the scope of the test_suite, too.
  26. GetParentRecord() now supports records in tables sys_update_xml, sys_update_set, sys_extension_instance, sys_ux_list, sys_ux_list_category, ts_table, sys_documentation (field labels) and sys_dictionary (table columns).
  27. GetRecord() now checks if the given sys_id is valid, hence avoiding unnecessary queries.
  28. GetRecord() now tries to get a record from within the scope instead of using GlideRecordQuery() and hence RunScriptInGlobalScope() in all cases.
  29. GetRecord() now supports a third parameter: bNoCrossScope. If set to true, GetRecord() will not try to load a record from the global scope if it cannot be loaded from DevTools' scope.
  30. IsValidSysId() now confirms that "global" is a valid sys id.
  31. AppBuilder() now also accepts a scope name as the parameter.

1.24.0 - 2021-09-22

  1. DevTools has been tested with Rome Release.
  2. RunScriptInGlobalScope() now supports seven input parameters.
  3. GetParentRecord() now also supports sys_aw_list and sys_aw_list_category.
  4. GetParentRecord() now checks if the GetParentRecord function in the called extension point really exists.
  5. Added function DocumentationAPI::RenderInstallationInstructionsRunTestSuite() to render instructions on how to enable ATF tests and run the app's test suite.
  6. Added function InstallerAPI::DeleteView() to delete views which (due to a platform defect) reappear after installation.
  7. Added a test to verify there are no temporary script includes left over by RunScriptInGlobalScope().

1.23.0 - 2021-09-16

  1. Orlando is no longer actively supported.
  2. GetParentRecord() now supports sys_atf_test_suite, incident_task, change_task, problem_task, sc_task, sc_req_item, sys_db_view_table and sys_db_view_table_field records.
  3. GetParentRecord() now supports tests which are part of multiple test suites if there is exactly one suite in the same scope.
  4. Introduced the DevTools extension point - to extend the GetParentRecord() function.
  5. Added DocumentationAPI::RenderExtensionPoint() function.
  6. AppBuilder() now also adds the AppSetProperty function.
  7. Fixed a defect in test step configuration "DevTools - Check scoped app sanity".
  8. Fixed a defect in AppSanity() when removing the snc_internal role from an ACL.
  9. Removed view "DevTools Install" as it was no longer needed.

1.22.0 - 2021-09-09

  1. When using the "Run Test" button on a test step form, the UI action will first check if there are unsaved changes and save the test step record instead of running the test.
  2. Introduced class TestAPI to support scripted tests by managing log output, result state and various generic test case functions.
  3. Introduced class InstallerAPI to support scripted installation steps (and refactored AppInstall() to use the new class).
  4. Added test step configuration "DevTools - Check test data sanity" to check if there is any test data left over with a given prefix.
  5. TestDataAPI now also supports sc_req_item and sc_task.
  6. Added function AppBuilder() to help building robust scoped apps.
  7. Added function AppBuilderAddTestToSuite() to add an ATF test to an existing ATF test suite.
  8. Added UI action "Add Test" to add a test to a suite in one click.
  9. Added UI action "Up" to navigate to a record's parent record if possible.
  10. The new function GetParentRecord() delivers a record's parent record if supported.
  11. Added function RenderSystemRequirements() to DocumentationAPI to automatically render system requirements including dependencies to other apps.
  12. Added function RenderInstallationInstructionsConfigureTableCrossScopeAccess() to DocumentationAPI.
  13. Added function RenderInstallationInstructionsBackgroundScript() to DocumentationAPI.
  14. Added function RenderUIActions() to DocumentationAPI.
  15. Added function RenderBusinessRules() to DocumentationAPI.
  16. Added function GetInstanceRecordPath(), GetInstanceRecordURL() and GetInstanceRecordURI() to produce different variants of a deep link to a specific record in the instance.
  17. AppSanity() now removes the snc_internal role from ACLs if there is at least one other role required for the ACL.
  18. AppGetName() now returns false instead of "undefined" if the app cannot be found.
  19. The test step config "DevTools - Check scoped app sanity" checks for unintended configuration of the role snc_internal in ACLs.
  20. Added business rule "sys_ui_action - set table to global" to allow global UI Actions. In a recent family release (Quebec?) the option of defining global UI Actions has been removed as the table field no longer allows to set the value to "global". This business rule fixes this issue by setting an empty table field to "global".
  21. RenderValue() now supports the bUnsortedKeys parameter to avoid sorting object keys.
  22. Introduced the function GetAppDependencies() to retrieve information about an app's dependencies to other apps.

1.21.0 - 2021-08-23

  1. Added function GetUserRecord() to get a user's GlideRecord object based on a sys_id, user_name or email.
  2. Added function PerformanceQuery() to measure query performance given a table, query string, a user, the number of repetitions and a limit of records to be returned. The function will provide the milliseconds of the fastest and slowest repetition, the average speed and the number of records returned.
  3. Added function PerformanceQueryMultiple() to execute multiple performance tests on a number of queries combined with a number of users in one go.
  4. TestDataAPI.CreateUser() can now set the user's email.
  5. RecordBulkProcess() now handles empty tables properly and stops immediately.
  6. AppInstall() is now accessible from all scopes. This enables other installation scripts in other scoped Apps to run the function as part of their own installation procedure.
  7. Extended the installation guide to run a background script to configure cross scope access to the sys_script_include table.

1.20.0 - 2021-07-06

  1. AppSanity() now sets is_private to false for system properties.
  2. AppSanity() now deletes useless ACLs for create and delete operations on fields.

1.19.1 - 2021-07-05

  1. TestDataAPI.GetAllUsers() scanned for users where the "name" started with the prefix instead of the "user_name". This has been fixed.
  2. RenderValue() now also sorts the field "user_name" to the top.
  3. ATF tests "DevTools - GetGroupsFromUser", "DevTools - IsUserHasRoleExactly", "DevTools - TestDataAPI - ITSM" and "DevTools - IsUserSecurityAdmin" were checking for the user name ("name") instead of the user id ("user_name") leading to inconsistent results on customized instances. This has been fixed.

1.19.0 - 2021-06-30

  1. Installation has been simplified. Only the sys_script_include table needs to be configured for cross scope access.
  2. Massive refactoring to remove the dependency to the cross scope configuration to various tables.
  3. Added functions GlideRecordDeleteMultiple() and GlideRecordSetValue() to perform said activities from global scope.
  4. Added function DocumentationAPI.RenderInstallationInstructionsAppInstall() to guide an admin to run the AppInstall() function during installation.
  5. Extended DocumentationAPI.RenderInstallationInstructionsImportFromSourceControl() with a new step to create a personal access token.
  6. Install() has been renamed to AppInstall().
  7. IsValidTable() now checks for an empty table name before getting the record.
  8. ATF test "DevTools - GetRolesFromUser" has been refactored into a single script.

1.18.0 - 2021-06-24

  1. Added function TestDataAPI.DeleteAllData() to delete all test data items.
  2. TestDataAPI.GetAllIncidents() now also lists the related task_sla records.
  3. TestDataAPI.CreateDatabaseView() now sets the order and left_join fields correctly.
  4. Added function IsArray() to check if a given value is an array or not.
  5. RenderValue() now displays nested empty arrays and empty objects as a separate row.
  6. RenderValue() now sorts keys of an object in a way that underscores are sorted to the end. This allows to implement a hierarchy using underscores as a prefix to a key name.
  7. RecordSetValue() is now using GlideRecordUpdate() internally making it more resilient against cross scope restrictions.
  8. Added module "Script Execution History" to access previous executions of background scripts.
  9. Refactoring to limit the use of Object.keys() to the GetKeys() function.

1.17.0 - 2021-06-21

  1. Added function GlideRecordDelete() to execute the deleteRecord member function of a GlideRecord in global scope.
  2. Added function SetProperty() to set any property regardless of its scope.
  3. Added function TestDataAPI.CreateDatabaseView() and associated functions to create database views as part of a test.
  4. TestDataAPI.CreateTestItem() did not delete the existing item before creating a new one, this has been fixed.
  5. Fixed the sort order in the "Query Log" module.
  6. The security notice regarding cross scope access configuration is now more prominent at the beginning of the documentation.
  7. The test step configuration "DevTools - Check scoped app sanity" now checks for notification subscriptions that are associated to the scoped app.

1.16.0 - 2021-06-10

  1. Changed the short description to "Code library and tools for ServiceNow developers".
  2. Added functions GlideRecordQuery(), GlideRecordInsert() and GlideRecordUpdate() to call GlideRecord's corresponding member functions in global scope.
  3. Added function IsValidDatabaseView() to check if the given string identifies a database view.
  4. Added function GetDatabaseViewsFromTable() to return all database views which use the given table.
  5. Added function ArrayRemoveValue() to remove a value from an array.
  6. Added function GetInstanceURL() to return the intance root URL.
  7. Added function GetTablesByColumnType() to return all tables which have at least one column of the given type.
  8. Function UserAddRole() is now public.
  9. Function IsValidTable() is now public.
  10. TestDataAPI.GetAllUsers() now also provides the user's roles.
  11. RecordSetValue() can now set values in records across scopes.
  12. Added the missing script macro for RenderBytes.

1.15.0 - 2021-05-05

  1. WARNING: New York is now longer actively supported.
  2. Added function IsTechnicalUser() to check if a given user is a technical user (i.e. web_service_access_only is set to true).
  3. Added function IsProperty() to check if a given system property exists.
  4. Added function AppSetProperty() to set a DevTools system property to a value.
  5. Added function UserImpersonate() which allows to impersonate a user from within a scoped application!
  6. Added function GetRecord() to serve as a shorthand to get a GlideRecord object for a record in a given table, identified by a sys_id.
  7. Added function GetRandomNumericToken() to create a pseudo-random numeric token string of a given length.
  8. Added function UserAddRole() to add a role to a user if the user doesn't have the role already.
  9. RunScriptInGlobalScope() did not work correctly if different scripts were provided within one transaction. It would always execute the first script during a transaction. This has been fixed. Please note that within a provided script, result values must now be set using "result =" instead of "return".
  10. RenderValue() now treats any object that has the sys_id key in the same way as a real GlideRecord object.
  11. GetGroupsFromUser() now checks for an empty user sys id. If an empty sys id was provided and for whatever reasons the sys_user_grmember has records with an empty sys_id, the associated groups would then be returned.
  12. Added view "DevTools" for scheduled jobs to show the "Run as" field.
  13. Renamed internal function SetDefaults() to AppSetDefaults().
  14. The test step configuration "DevTools - Check scoped app sanity" now uses IsTechnicalUser() to check correct configuration of scheduled jobs.

1.14.0 - 2021-04-20

  1. Added function RenderBytes() to return a user friendly number of bytes using KB, MB and GB where appropriate.
  2. Added function RecordDelete() to delete a single record based on a table name and the record sys id.
  3. RecordBulkProcessor() now detects if updating a record fails and aborts the processing. If the update fails, the maintenance date time field cannot be updated and the function would retry the same record until thresholds are reached.
  4. Added test "DevTools - Test data sanity" to check if all test data has been cleaned up in previous test runs.
  5. Added internal function SetDefaults() to set all DevTools system properties to their default values.

1.13.0 - 2021-04-15

  1. Added the StopWatch class which serves exactly as what its name suggests.
  2. Added function GetTimeNow() which is a shorthand for "new Date().getTime()".
  3. Added function GetTransactionRuntime() to return the amount of milliseconds passed since the start of the current transaction.
  4. GetGroupsFromUser() can now return the list of a user's groups with an encoded filter applied to the groups.
  5. Added function BusinessRuleGetOperation() to return the operation (of a business rule) based on the provided record.
  6. Debug() can now display the current transaction runtime in milliseconds. The new property x_snc_devtools.debug.log.transaction_runtime controls if the transaction runtime should be included or not.
  7. RenderValue() has been improved: In case of a GlideRecord, the table name, sys_id and number (if available) are displayed on top and a selected choice of fields leads the list of values despite the alphabetical order.
  8. The test step configuration "DevTools - Check scoped app sanity" now checks scheduled jobs for only technical users or the system admin serve as the run_as user.
  9. Added module "Query Log" to track invalid queries.
  10. The module "Outbox" is renamed to "Outbox or Sent" and displays sent mails.
  11. Improved column order in module "Storage Column Aliases".

1.12.2 - 2021-03-22

  1. Fixed a defect in IsVersionCompatible().

1.12.1 - 2021-03-22

  1. Fixed a defect in the test step configuration "DevTools - Check scoped app sanity".

1.12.0 - 2021-03-22

  1. RecordBulkProcessor() will no longer process the same record twice in one go.
  2. Test step configuration "DevTools - Check scoped app sanity" now checks for useless field level ACLs.
  3. Test step configuration "DevTools - Check scoped app sanity" now checks for misconfigured test steps.
  4. Test step configuration "DevTools - Check table cross scope access" checks if "Caller access" is set to "Caller Restriction".
  5. Added a comprehensive syntax editor macro for "RecordBulkProcessor" with boilerplate code.

1.11.0 - 2021-03-19

  1. Madrid is no longer supported.
  2. Added function RecordBulkProcessor() to process large amounts of records using a callback function.
  3. Added function Clone() to clone objects. This is to heal the JavaScript inherent design flaw around object references instead of copies.
  4. Added function Merge() to merge two objects.
  5. Added function RecordSetValue() to set a single field value on a given record.
  6. Added function IsObject() to distinguish objects from other types.
  7. Added function IsValidTable() since the TableUtils script include is not accessible from a scoped app.
  8. Added function RenderDateTime() since Javascript has no built-in function to render an ISO date/time string.
  9. Added function Sleep() to do nothing for a set amount of seconds.
  10. RenderValue() now has a second parameter "bHideEmpty". If set to true, empty values in objects are ignored - leading to better readable output.
  11. RenderValue() sorts keys of objects alphabetically. However, the keys "name", "short_description", "number" and "sys_id" will always lead the pack.
  12. RenderValue() now displays empty objects as "{}".
  13. IsEqual() can now compare objects.
  14. TestDataAPI: Added function GetAllData() and corresponding functions for each supported record type GetAllIncidents(), GetAllProblems(), etc.
  15. TestDataAPI: Added function CreateTestItem() and GetAllTestItems() to manage entries in the table x_snc_devtools_test which is used for testing.
  16. ParseDateTime() is now more resilient against incorrect input.
  17. The test step configuration "DevTools - Check scoped app sanity" now checks for empty descriptions in publicly accessible script includes.
  18. Improved installation instructions.

1.10.0 - 2021-02-26

  1. Added function GetAppName() to return the name of a scoped application but without any name postfixes to indicate work in progress. This function is needed to create clean test step configuration descriptions.
  2. Added function AppSanity() which performs a number of changes to a scoped app's assets to maintain applicaton sanity. E.g. the function removes the copied_from attribute in atf tests.
  3. RenderValue() was improved: In case of objects, the keys are displayed in alphabetical order. In case of arrays, the elements are displayed in the given order as before.
  4. Added function DocumentationAPI::RenderListItem() and refactored all Render*() functions.
  5. The test step configuration "DevTools - Check scoped app sanity" now checks for jelly breakpoints in UI pages.
  6. Added configuration options section to the documentation.
  7. Removed unnecessary debug logging in TestDataAPI.

1.9.0 - 2021-02-15

  1. Quebec is now supported.
  2. Added function GetRolesFromUser() to get the sys_ids of all active roles of a user.
  3. Added function TestDataAPI::CreateRole() to create a role for testing purposes.
  4. TestDataAPI::CreateUser() now also accepts the name of a role without the prefix.
  5. Added function DocumentationAPI::RenderInstallationInstructionsImportFromSourceControl() to render installation instructions for importing an application from source control.
  6. Added function DocumentationAPI::RenderDisclaimer().
  7. Improved the rendering of script include documentation in DocumentationAPI::RenderScriptIncludes().
  8. Added missing description to the DocumentationAPI script include.
  9. Test step configuration "DevTools - Check scoped app sanity" now checks if the app's short_description is empty.
  10. Test step configuration "DevTools - Check scoped app sanity" now checks if a module's link_type is set to "HTML" (which doesn't work properly).

1.8.0 - 2021-01-21

  1. Added the DocumentationAPI class to render HTML fragments for a documentation UI page.

1.7.0 - 2021-01-20

  1. Added function IsValidVersion() to check for a valid (ServiceNow app) version string.
  2. Added function IsVersionCompatible() to check a version against a requirement.
  3. Added test step configuration "DevTools - Check scoped app dependency". This test step configuration checks if another required scoped application is installed in a (backward) compatible version.
  4. Added module "Background Script" to open the background script page in a new window.
  5. Added new navigation section "Transaction" and moved all transaction related modules into it.
  6. Added new navigation section "Cache" for easy access to the cache inspection tool and to flush the cache.
  7. Added new navigation section "Events" to easily access the event log, event registry, notifications, and outbox.
  8. Added more test cases for GetIntegerValue().

1.6.0 - 2021-01-14

  1. Added function IsTableCrossScopeAccessible() to check if applications from other scopes can perform read, create, update and delete operations on the given table.
  2. Added function RunScriptInGlobalScope() to run a script in the global scope from within a scoped application. Note that the function required full cross scope access to the sys_script_include table.
  3. IsEqual() now uses type strict comparison and will no longer return true in case of IsEqual(1,"1").
  4. The "Rerun Test" button has been renamed to "Run Test" and is now available on all forms that directly refer to an ATF test (including test steps).
  5. The ATF tests "TestDataAPI" and "GetGroupsFromUser" now make use of the "DevTools - IsTableCrossScopeAccessible" test step configuration to check if the cross scope access to the tables is configured.
  6. The ATF test "Installation" now checks if the system property glide.record.legacy_cross_scope_access_policy_in_script is set to true to avoid cross scope access policy errors. Refer to KB0711970.

1.5.0 - 2020-11-23

  1. Added test step configuration "DevTools - Check scoped app sanity". This test step configuration takes a scoped application and checks if all its sys_properties are NOT set to private, and all ATF tests have an empty copied_from field. More checks will be added later.
  2. Added test step configuration "DevTools - Check table cross scope access"
  3. Added test step configurations to the documentation.
  4. Added test "DevTools - Installation" to check if all relevant tables are configured according to the installation guide.
  5. Added test "DevTools - App Sanity" to check if the app sanity is ok.
  6. Added table sys_user to the list of tables which need full cross scope access.

1.4.0 - 2020-11-16

  1. Added function IsUserSecurityAdmin().

1.3.0 - 2020-11-04

  1. Added class TransactionCacheAPI.
  2. Added function HtmlEncode().
  3. Added function GetKeys().
  4. Added function StringRemoveCharacters().
  5. Part of the documentation is generated automatically based on record descriptions.

1.2.4 - 2020-09-10

  1. ParseDateTime() has been repaired, aligned to UTC and the corresponding test has been implemented.
  2. LoadMessages() now takes the language as the second parameter. Defaults to 'en'.
  3. GetBoolValue() was not accessible out of scope. This has been fixed.
  4. IsValidRecord() now also checks for type ScopedGlideRecord and ScopedGlideRecordSecure. The ATF test has been updated accordingly.
  5. TestDataAPI functions now display the sys_ids of created records in the log.
  6. Added the "Cancel Transactions" module.
  7. Added test and macro for IsUserHasRoleExactly().
  8. Added the system property x_snc_devtools.ui.list_button to control if the "List" button should be visible or not.
  9. Extended documentation with a reference to all script includes.

1.2.3 - 2020-08-21

  1. Added the "Transaction Log" module.
  2. "Evaluator Log", "Debug Log" and "App Log" modules only show the last 30 minutes.
  3. Added the "Storage Column Aliases" module.
  4. RenderValue() can now work properly with nested objects.

1.2.2 - 2020-08-02

  1. RenderValue() no longer causes the following error: com.glide.script.fencing.MethodNotAllowedException: Function getValue is not allowed in scope x_snc_devtools.

1.2.1 - 2020-07-30

  1. GetArrayValue() now returns an empty array for an empty string.

1.2.0 - 2020-07-07

  1. Added TestDataAPI.CreateRequest() and extended the ATF test "DevTools - TestDataAPI"
  2. Refactoring of several functions in TestDataAPI. Caller and Opener users can now be set explicitly.
  3. Added function IsValidRecord()

1.1.0 - 2020-07-03

  1. Added TestDataAPI.CreateProblem() and TestDataAPI.CreateProblemTask()
  2. The install script is now a scheduled script that can be run on demand instead of a fix script that runs automatically.

1.0.0 - 2020-06-23

First baselined version