Welcome to DevTools - created and maintained by Sascha Wildgrube.
Code library and tools for ServiceNow developers.
DevTools contains a number of Script Includes with useful javascript functions and classes like a GetType() function that really works. Several 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.
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 functionsn 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".
x_snc_devtools.InstallApp("x_snc_devtools");
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()));
DevTools contains a wide variety of functions and classes (server-side and client-side) for re-use.
Please refer to the reference section for details.
DevTools contains a number of very helpful UI Actions. One of the most powerful features is the "Save" button with active scope switching capabilities. Never ever loose changes because of switching between scopes and browser tabs at the same time.
Please refer to the reference section for details.
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. I 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.
To enable cross scope scripting the system property glide.record.legacy_cross_scope_access_policy_in_script must be set to true. As of the release of this DevTools version the only publicly accessible documentation of the system property's behaviour can be found in the knowledge base article KB0779287.
The "Baseline Version" button on the application form is used to baseline an application version. To baseline an application means to provide a new version of an application from a development environment in a linked source control system. This enables installation to downstream instances or for public availability. The following steps are performed:
A "Shared Application" is an application that is created and developed by a 3rd party, members of the open source community, a different department or organization. The application is hence "shared" by that other entity and imported to your own organization.
This requires such shared application to be treated differently than applications that are created and developed by your own organization:
DevTools helps you with all of that (except for the decisions how required changes are made). By adding a record in the "Shared Applications" table for a shared application, the application is managed properly during baseline.
In an ideal world all customizations are implemented in scoped apps (and some global scoped apps if there are really good reasons). And in that same ideal world, non of these apps have any dependencies. Each app can be installed and uninstalled independently. The real corporate world, however, is complex, messy and full of dependencies. For good reasons, separate capablities are implemented as separate apps and hence these apps have dependencies to each other. For example: apps add fields to tables that are defined in other apps, they run scripts from other apps, or rely on logic implemented in flows from other apps.
Such dependencies must be managed - that means, the requirements of one app towards other apps and their minimum versions, must be documented and considered when performing deployments.
DevTools provides means for that documentaton and visualization of these dependencies. Go to the sys_app form, switch to the DevTools view to find the dependencies related list (not the OOTB dependencies). The UI action "Dependencies" opens a ui page that visualizes the dependency requirements and status of the current app as a tree and as a list, which can be used as a deployment plan.
A Technical Debt is any code or structure that a development team considers as to-be changed at a later point in time because it implies some form of burden to the development and deployment work to be done today.
Technical debts need to be managed - and that starts with documenting it. DevTools contains a table to store Technical Debt records which are part of an application and hence are deployed to target-systems. This allows for reporting, work planning and automated documentation.
Unfinished, defective or deprecated features that are part of an application at the time of a version baseline also represent a form of Technical Debt - as all of these require future work. Such features should eventually be hidden from users or prevented to impact the behavior of an application.
In cases where the technical debt is associated with a feature that needs to be turned on or off, a technical debt may have an ID and a boolean "switch" that can be used to control logic around these features. Developers can use the following pattern to control how code related to a feature that is currently considered as (or associated with) a Technical Debt should behave:
if (x_snc_devtools.GetTechnicalDebtSwitchState('x_your_scope','id_of_the_technical_debt') == true) { // Hide unfinished work // Deactivate defective features // Deactivate deprecated features }
If the Technical Debt with the given id exists and the switch is set to true, the function returns true, otherwise false.
DevTools helps to surface evaluator errors (which are logged as warnings OOTB). The system property x_snc_devtools.ui.show_evaluator_errors.minutes controls whether and for how long evaluator errors should be displayed to admin users.
DevTools enforces to switch to the scope of the current record on a form. This prevents any situation in which a form was loaded in the correct scope, changes are being made, and lost because the user changed the scope in a different tab. The OOTB behavior is downright annoying. DevTools comes to the rescue. The system property x_snc_devtools.ui.force_scope controls whether the scope should be changed when loading and saving a form. This may lead to some users being confused by the new (and unexpected) behavior - however, developers quickly become used to it and prefer the behavior over the OOTB behavior.
An instance has a technical name (sometimes matching the domain name, but not always). This technical name can be used to define logic that depends on the instance on which code is executed. However, this is not a good practise. In complex environments, where applications may be shared across multiple production instances, any logic that directly depends on a specific instance may cause problems. The DevTools extension point allows to implement the function DevToolsGetInstancePipelineName() which allows to map technical names to so-called pipeline names (e.g., "dev", "test" or "prod"). The function GetInstancePipelineName() can then be used to get the current instance pipeline name to build instance specific logic.
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.
DevTools contains the business rule sys_flow_context - Set domain which implements the workaround to the issue described in KB0998966.
Instance Scan linter checks execute on all records that have at least one script field. However, some records may have a script field but do not use it or the script field does not have to be checked because it is not relevant (based on the configuration of that record).
Examples are:
The business rule sys_metadata - Prevent useless checks prevents checks from running in such cases which may significantly reduce the time required to scan such records - or apps that contain such records.
Developers may create their own Application Files which also can contain script fields. In some cases such script fields are not used - but also scanned by Instance Scan linter checks. The DevTools extension point allows to inject additional rules that can help to avoid useless checks on such records. To define and inject such rules follow these steps
function GetEncodedQueryToPreventUselessChecks(rules) { // The following combination is already supported by DevTools // The following rule is for demonstration purposes only x_snc_devtools.SetValue( { query: 'virtual=true', // The query to be used to avoid loading the record derived: true // true if applicable to derived tables, false if not }, rules, 'script', // only script checks are supported at this time 'sys_dictionary' // The class name of the table to apply the rule to ); return rules; // always return the rules object, otherwise all rules are deleted }
DevTools features the "Create User by Email" button to the User list. Follow these steps to configure the feature:
DevTools features the "Generate and Send Credentials" button to the User form. Follow these steps to configure the feature:
Data is managed on each instance and should not be "deployed". Code is part of applications and should be deployed as such.
However there are cases where the boundaries are blurry. If data records (i.e. records that are not in a table derived from sys_metadata) must be part of an application the Record Transporter comes to the rescue.
The Record Transporter allows to store any record that is not a sys_metadata derivative into a table that is. The table in which these records are stored is x_snc_devtools_transporter_record (which is derived from sys_metadata) and hence its records are captured as part of an application (in source control). Such records are associated to a Record Transporter Package (in table table x_snc_devtools_transporter_package).
To "pack" records into a Package, create a Package in the GUI - but make sure to select the scope of the application that should contain the package - then use the function RecordTransporterRecordPack() to store individual records into the package.
To properly "store" to be deleted records use the function RecordTransporterPackageReset() before adding records to a package. The function will mark all existing records in the package to be deleted on the target instance. Once added again, these records will be stored to the package to be inserted or updated. This allows to keep track on deleted records of earlier versions of the package.
During installation use the method InstallerAPI::RecordTransporterPackageUnpack() to unpack the contained records on the target instance.
Code to store records could look like this:
// To set all existing records as to-be-deleted x_snc_devtools.RecordTransporterPackageReset('x_your_scope.demo'); // Identify records based on whatever logic var grRecords = new GlideRecord('x_snc_devtools_test'); grRecords.addQuery('name','STARTSWITH','Test '); grRecords.query(); while (grRecords.next()) { // Pack the identified record into the package x_snc_devtools.RecordTransporterRecordPack('x_your_scope.demo',grRecords); }
To unpack records, implement the AppInstall() function in your app like this:
function AppInstall() { var installer = new x_snc_devtools.InstallerAPI(x_snc_devtools.GetAppName('x_your_scope')); installer.RecordTransporterPackageUnpack('x_your_scope.demo'); return installer.Finish(); }
DevTools introduces a new CMDB CI class called "ServiceNow App" which represents a ServiceNow app (scoped or global) that is installed on an instance or provided in a Source Control System for installation.
Functions prefixed with "ConfigurationItemServiceNowApp" can be used to insert or update these CIs.
If the system property "x_snc_devtools.code.auto_generate_documentation" is set to "true" a business rules will add some auto-generated documentation to the description of Script Includes that contain a class if the code has changed.
DevTools can help to format (float) numbers in forms, related lists and list views in the classic UI - Polaris, however, is not supported yet! Follow these steps to activate the feature:
function DevToolsGetFormatConfig(grRecord) { var strTable = grRecord.getRecordClassName(); if (strTable == 'your_table') { var formatconfig = { your_field: { decimals: 2, postfix: ' %' } }; return formatconfig; } return false; }
The function RecordManageOrder() can be used set the records in a table into a definitive sequence based on a given integer field. The function is designed to be called in an async after update/insert/delete business rule like this:
(function executeRule(current, previous /*null when async*/) { var RecordManageOrder = x_snc_devtools.RecordManageOrder; RecordManageOrder('your_table', 'order', current ? current.sys_id : null, current ? current.order : null); })(current, previous);
"your_table" is the technical name of the table in which records should be sorted (or ranked). "order" is the name of the integer field that defines the ordering sequence.
The "current" object is null in an after delete async business rule, hence the conditional statements.
Defines the text that should be displayed to the user before starting the baseline procedure. If empty, no message box is displayed.
If set, the text will be displayed in a message box offering "OK" and "Cancel" options.
Defines the text that should be displayed to the user before starting the baseline procedure. If empty, no message box is displayed.
If set, the text will be displayed in a message box offering "OK" and "Cancel" options.
When inserting or updating the relationship between two ServiceNow apps in the CMDB the relationship type specified will be used.
If set to true code documentation is auto-generated for Script Includes containing classes.
Controls if debug output should contain the current transaction runtime in milliseconds.
Specify DevTools log level. Valid choices are error, warn, info and debug.
Controls if the "Version Baseline" button should be visible.
Controls if the "Create Technical User" button should be visible.
Controls if the "Create Test User" button should be visible.
Controls if the "Create User by Email" button should be visible.
Controls if the "Delete Update Set" button should be visible.
Controls if the "Dependencies" button should be visible.
Controls if the "Find Sys ID" button should be visible.
Controls if the user's current scope should be forced to the record's scope on all forms.
Controls if the field formatting feature is active or not. If it is, in classic UI forms, related lists, and list views, read-only fields are being formatted according to rules specified by a function implemented via the DevTools extension point.
Controls if the "Generate and Send Credentials" button should be visible on the sys_user form.
Controls if the "Go to Test" button should be visible for supported tables.
Controls if the "List" button should be globally visible.
Controls if the "Parent Table" button should be globally visible.
Controls if the "Save" button should be globally visible.
Controls if the warning on records that contain credentials should be displayed.
Controls if recent evaluator errors should be displayed on every screen. The value is the time span in minutes that should be considered. If the value is set to 5 a message will appear if an evaluator error has been logged within the last 5 minutes. If the value is 0, no message will be displayed.
Controls if the "Up" button should be visible for supported tables.
Controls if the "What Runs" button should be visible.
The table is derived from table Application File (sys_metadata).
The table is derived from table Application (cmdb_ci_appl).
The table is not derived from any other table.
The table is derived from table Application File (sys_metadata).
The table is not derived from any other table.
The table is derived from table Application File (sys_metadata).
The table is derived from table Application File (sys_metadata).
Adds a "Run Server Side Script" test step to the current test.
Adds a test to a suite
Helps to baseline the current version of a shared application.
Helps to baseline a new version by setting all default values using the AppSetDefaults() function of the app and removed any "WORK IN PROGRESS" postfixes from the application name.
Create a syntax editor macro to access the function or class defined in the script include.
Creates a new technical user based on a given name
Creates a new technical user based on a given name
Creates a new user based on a given Email address
Delete this update set. Available to admin users only.
Displays the dependencies documented for this application (or package).
Execute a scheduled job on demand and stay on the current form. This UI Action replaces the OOTB Execute Now UI Action.
Asks the user for a Sys ID and if the record exists, navigates to the record's form page. Available to admin users only.
Generate a new password, sets the user name if necessary and send the new credentials via mail to the current user.
Navigates to the shared application record associated to the application
Navigates to the test associated to a script include if the test exists.
Navigates to the default test suite of the current application.
Navigates to the record (if it exists).
The "List" button navigates from a record's form view to it's list view.
If the current table has a parent, navigates to a list view of the parent table.
Executes the installation scripts of the app and all its dependencies.
Run an ATF test directly from any screen that has a reference to a test.
If the result was a success, the user can run the associated Test Suite again.
Global Save button with scope change capability
Shows the choices associated to all fields in a table.
Shows the table's "collection" dictionary record.
The "Up" button navigates to the record's parent record (if possibe).
Opens the whatruns page to display an analysis on what runs on the table for the different CRUD operations.
Adds a "Run Server Side Script" test step to the given test.
AppBuilder adds various application files to a scoped app. The function should be mostly idempotent.
The function creates a syntax editor macro in the given application scope.
Add an ATF test to an existing test suite.
Retrieves information about the app's dependencies to other apps and required versions.
Gets a DevTools system property.
This script installs DevTools
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.
Sets a DevTools system property.
Creates a new version baseline for the given application. Handle with care! This function is still experimental.
Checks if the given application's manual page contains valid release notes.
If the application has a manual page and if the manual page contains a "Release Notes" section, then it checks if there is a sub-section titled with the current version and the current date.
Returns true, if no "Release Notes" section can be found OR the subsection exists, or false, if the sub-section does not exist.
Returns true of a background job to baseline a new application version is already running, false if not.
Appends the second given array to the first.
Returns the array of elements that are contained in both given arrays.
Adds a value to an arry if it doesn't exist yet. Returns the resulting array.
Removes a value from an array.
Returns an array with unique values only.
Checks if a value exists in an array and returns true in that case, otherwise false.
Decodes a base64 encoded string and returns the original binary stream or string.
Converts a string or binary stream into a base64 encoded string.
Binds all functions of the given object to the given object. This is needed to access the "this" object within every function of the class.
Javascript is inherently broken and the fact that this function is even necessary can serve as proof.
Returns the operation (of a business rule) based on the provided record.
Clears the application menu cache.
Creates a copy of the given value.
If the parameter bSortKeys is set to true and the given value is an object, the resulting object contains its members sorted alphabetically.
Returns -1 if the first dependency status is less severe than the second, returns 0 if the two dependency status are equal, returns 1 if the first dependency status is more severe than the second.
Returns -1 if the first version is lower than the second, returns 0 if the two versions are equal, returns 1 if the first version is higher than the second.
Inserts or updates a configuration item that represents the given ServieNow application (record or object) on the given instance.
Inserts or updates a configuration item that represents the given ServieNow application (record or object) on the given instance.
Inserts or updates configuration items that represent the all ServieNow apps from an array of objects representing apps.
Inserts or updates configuration items that represent the all ServieNow apps from a dependency tree object.
Returns the Sys ID of the created or updated CMDB CI representing the application at the root of the tree.
Inserts or updates configuration items that represent the all ServieNow applications on the instance.
Create a PDF file based on html and attaches the created file as an attachment to the given record.
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.
Creates a new technical user based on a given name, an optional role and password. Returns the Sys ID of the new user if successful or false if the user could not be created or if the specified role could not be found.
Creates a new test user based on a given name. Returns the Sys ID of the new user if successful or false if the user could not be created.
Creates a new user based on a given Email address and assigns the specified groups. Returns the Sys ID of the new user if successful or false if the email address is not valid or a user with that email address already exists.
Converts a monetary amount from one currency to another.
Creates a new database index if it doesn't exist yet. Warning, there is no way to undo that operation!
Produce a debug log output but only if the x_snc_devtools.logging.verbosity system property is set to "debug".
The function is to be called from within code that is considered as deprecated - and hence is expected to be removed in a future major version. It issues a warning to the log and the screen.
The DevToolsClientAPI is a client callable proxy for ajax calls to some of the functions provided by DevTools.
The DevToolsWorkerAPI class contains proxy functions to functions that do lengthy operations and hence may be executed through a process worker.
The DocumentationAPI helps to render fragments of an HTML page that documents the components of a scoped application.
|
Methods:
* initialize()
* RenderHeader()
* RenderDescription()
* RenderListItem()
* RenderCopyright()
* RenderDisclaimer()
* RenderLicense()
* RenderRoles()
* RenderProperties()
* RenderTables()
* RenderConnectionAndCredentialAliases()
* RenderEvents()
* RenderUIActions()
* RenderScriptIncludes()
* RenderUIScripts()
* RenderBusinessRules()
* RenderScheduledJobs()
* RenderTestStepConfigurations()
* RenderExtensionPoints()
* RenderInstanceScanChecks()
* RenderEditorMacros()
* RenderRestApis()
* RenderDependencies()
* RenderTechnicalDebts()
* RenderSystemRequirements()
* RenderInstallationInstructionsImportFromSourceControl()
* RenderInstallationInstructionsBackgroundScript()
* RenderInstallationInstructionsConfigureTableCrossScopeAccess()
* RenderInstallationInstructionsAppInstall()
* RenderInstallationInstructionsRunTestSuite()
* RenderError()
Checks if the current application contains records containing credentials and displays a warning.
Generates a new password for the user, sets the user name if required, sets the password needs reset flag and sends the new credentials to the user via mail.
This requires the "glide.email.smtp.active" system property to be "true".
Returns an object that contains all details of all tables, including a list of tables that are extended from a table if requested.
Returns a list of all known source control branches of the application.
Returns the current source control branch to which an application is linked.
Returns the default test suite of the given application or false if the application or the default test suite does not exist.
Returns the record of the given application's manual UI Page, or false if the application does not have a manual UI Page.
Returns the name of a scoped application (and removes any "work in progress" postfixes).
Get an application record based on sys_id or scope name.
Returns an array with records which contain credentials contained in the given application.
The parameter bGeneric controls if a generic search should be performed - which may catch records in tables not defined OOTB but is significantly slower.
Returns the scope name of a scoped application.
Returns an array of objects detailing the records that are currently not committed to the current source control branch of the given application. If the application is not linked to source control, the function returns false.
Returns an array no matter what input type is given and performs necessary conversion if another type is provided.
Returns the base table of the given table, or the table itself if it is not extending any other table.
Returns either true or false no matter what kind of value is given.
Returns the call stack in a structured format.
Strips postfixes indicating unfinished work from an application name based on the given string.
Returns an object with "url", "username", "password" and "apikey" values (which are populated depending on the credential type) if the given (http) connection alias can be resolved, otherwise false.
Get a country record based on sys_id, name or ISO3 code.
Returns an object with "username", "password" and "apikey" values (which are populated depending on the credential type) if the given credential alias can be resolved, otherwise false.
Returns the current record based on either an existing current object or (if not available) based on the current url.
Returns the currently selected scope from the user session.
Returns the current url if possible, if not it returns the instance root url.
Returns the database views which use a given table.
Returns the current date as a string in UTC.
Transforms a dependency tree into a dependency list.
Returns the number of errors contained in a dependency tree. If the provided dependency tree is not an object, the function returns 1.
Returns an object with "apikey", "username" and "password" fields or false if the credential object is null.
Logs an error if the details cannot be provided.
Returns system diagnstics as an object.
Returns the dictionary override record based on the given table and column name if it exists.
Returns the dictionary record based on the given table and column name. The function can also handle elements (columns) that are defined for parent tables.
Returns patterns found in evaluator errors, which should be ignored - as they are produced by OOTB components.
Returns a float value.
Retrieves formatting information for the fields of the given records.
Gets an array with the names of all functions of a given object.
Get a group record based on sys_id or name.
Returns all groups of a given user. An additional filter can be applied to the groups to be returned.
Generate a hexadecimal SHA 256 hash string.
Returns the URL path of a table's list in the instance.
Returns the URI of a table's list in the instance.
Returns the URL of a specific record list in the instance.
Returns the instance name.
Returns the pipeline name of the given instance. If no (technical) instance name is specified it returns the pipeline name of the current instance.
The "pipeline name" is the name of the instance that reflects its role in the pipeline. Typical names are "dev", "test" and "prod". In order to map technical instance names to pipeline names an application must implement the DevTools extension point and implement the DevToolsGetPipelineName() function.
If no mapping is available, the function returns the technical name of the given (or current) instance.
Returns the url path of a specific record in the instance.
Returns the URL path of a specific record in the instance.
Returns the URL of a specific record in the instance.
Deprecated version of GetInstanceRecordUrl().
Returns the instance root url.
Deprecated version of the function GetInstanceUrl().
Returns an integer value.
Returns all key names of an object in an array. Returns an empty array if no object is provided or no members exist.
Returns the length of the given parameter or 0 if the parameter is not defined or null.
Returns the DevTools link directory with many useful links for admins and developers.
Returns the minimal common version based on two lists of versions. If no common version can be identified, false is returned.
Retireves all dependencies of the given package as a list of objects sorted by deployment order.
Retireves all dependencies of the given package as an object tree.
Get a package record based on sys_id, scope name, name or the record itself.
Returns the version of a package if it exists, otherwise false.
Returns the specified url parameter as a string value.
Get the parent record of a given record if it is possible.
Returns the parent table of the given table. False if the given table does not exist or is not derived from another table.
Returns all properties of a given object or an empty array if the given value has no properties.
Gets a system property independent of its scope.
Returns a pseudo Sys Id which is valid but VERY unlikely to exist.
Get a pseudo-random string token of a given length consisting of numbers only.
Retrieves the evaluator errors logged in the last given amount of minutes.
Shorthand to get a record from a table based on a sys_id or a GlideRecord object. 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.
Returns the sys_id of the record that has been created or found in the given test step.
Returns the url path of a specific record.
Returns the Sys Id of the scope of the given record, or false if the record is invalid or not derived from sys_metadata. The function also considers records that are derived from sys_scope (like sys_app or sys_store_app).
Returns the uri path of a specific record.
Returns an array with the names the active roles of a user.
Get a role record based on sys_id or name.
Returns an array with the sys_ids of the active roles of a user.
Returns the sys_id of a system property based on its name.
Returns the GlideRecord object that contains the script from which GetScriptRecord() is called or if nStackLevel is greater than 0, the record that contains the script that contains the code of the corresponding stack level.
Returns the shared application record based on the given app or shared application Sys Id.
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.
Returns the current call stack as a raw, unprocessed string.
Returns a string value in all cases. Arrays and objects are converted into comma separated strings.
Returns the table of the record identified by a given sys_id.
Returns the record that represents the given table.
Returns all tables which have at least one column with the given type.
Returns the boolean state of the switch of a technical debt record if it exists, or false if it does not exist.
Returns the ATF test record for the given record if a matching ATF test exists.
Script Includes and Scan Checks are supported.
Returns the number of millisenconds passed since the start of the unix epoch.
Returns the number of millisenconds passed since the start of this transaction.
Returns the type of a value.
Get a user record based on sys_id, user_name, name or email address.
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.
Retrieves all variables available for a record in an object including their names and values.
Returns a semantic version string from the given string (which may be an application name including a version or a branch name).
Interface to the GitHub API.
|
Methods:
* initialize()
* SetCredential()
* SetMidServer()
* SetBasicAuth()
* SetApiUrl()
* GetApiUrl()
* Error()
* GetRequestCount()
* Request()
* GetPublicReposFromOwner()
* GetBranchesFromRepo()
* GetFilesFromBranch()
* GetFile()
Interface to the GitLab API.
|
Methods:
* initialize()
* SetCredential()
* SetBasicAuth()
* SetMidServer()
* SetApiUrl()
* GetApiUrl()
* Error()
* GetRequestCount()
* Request()
* GetPublicProjects()
* GetProjectPath()
* GetTreePath()
* GetBranchesFromRepo()
* GetFilesFromBranch()
* GetFile()
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.
Executes the delete member function of a glide record in global scope.
Executes the deletemultiple member function of a glide record in global scope.
Executes the insert member function of a glide record in global scope.
Executes the query member function of a glide record in global scope.
Calls the function restoreLocation on the given GlideRecord object. This function is yet another cross-scope wrapper for a function that is not available in scope for no reason.
Executes the setValue member function of a glide record in global scope.
If "sys_id" is the field to be changed, the new Sys ID will only be set if the GlideRecord::newRecord() function has been executed before on the record.
Executes the setValue member function of a glide record in global scope for all values provided in the given object.
If one of the keys is the "sys_id" the new Sys ID will only be set if the GlideRecord::newRecord() function has been executed before.
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.
Converts a string to html.
Renders all dependencies of the given package.
Renders an error message in Html.
Renders an image that is stored in db_image into an html document.
Renders an info message in Html.
Renders an HTML link.
Renders a link directory with based on a given linkdirectory object.
Renders an ordered list based on an array.
Renders html elements that exactly reflect a DIN A4 page to support PDF rendering.
Renders the applications overview and status page.
Render the given text as preformatted text in html.
Renders a black and white QC code image based on the given payload string as plain vanilla html.
Renders a script into an html output that causes a page redirect to the given url.
Renders an html div with rounded corners.
Renders a script in Html.
Renders the html tag required to include a script via url (e.g. from a CDN).
Renders a html style tag.
Renders a table in html.
Renders a tab navigation, where the current tab is highlighted.
Renders a tree structure based on a given object.
Renders an unordered list based on an array.
Renders any value using RenderValue() into an html document.
Renders an error message in Html.
Renders a the outcome of the WhatRuns() function for the given tables.
Performs a single synchronous http request.
The vInput parameter can either contain the target url as a string or a parameter object.
Values in the parameter object are:
- url: the url to be requested
- method: the http verb to be used (e.g. "get", "post", etc.)
- requestbody: the string to be sent as the request body. If provided the method is set to "post" no matter what is specified in the method parameter.
- basicauth: An object containing values "username" and "password"
- response: A string to specify how the result should be returned by HttpRequest. If set to "RESTResponseV2" an object is returned if the request did not run into an exception, otherwise the function returns the response body.
- headers: An array of objects representing a header. A header object should contain values "name" and "value".
- mid_server: the name of a MID server to be used to relay the request.
A class representing an image which can be used to generate BMP files or html output.
|
Methods:
* initialize()
* Reset()
* Color()
* ColorBlack()
* ColorWhite()
* ColorRed()
* ColorGreen()
* ColorBlue()
* ColorToHex()
* SetPixel()
* GetPixel()
* GetPixelHex()
* MakeDemo()
* CreateBitmapFile()
* getLittleEndianHex()
* HtmlRenderImage()
Runs the AppInstall function of the given app and of all its dependencies.
The InstallerAPI class supports scripted installation steps as part of the installation of a scoped app.
|
Methods:
* initialize()
* IsAborting()
* Log()
* Error()
* FatalError()
* Finish()
* GenericAction()
* RecordInsertOrUpdate()
* RecordSetValue()
* RecordDelete()
* DictionarySetValue()
* DictionaryOverrideSetValue()
* DocumentationSetValue()
* CheckTableCrossScopeAccessibility()
* SetProperty()
* SetHomePage()
* SetTableAttribute()
* SetTableColumnAttribute()
* SetTableDefaultOrder()
* ChoiceInsertOrUpdate()
* DiscoverySourceInsertOrUpdate()
* DeleteView()
* DeleteUISection()
* InstallGlobalSystemProperty()
* InstallSystemPropertyCategoryMapping()
* ActivateBusinessRule()
* ActivateClientScript()
* ActivateUiAction()
* ActivateUiPolicy()
* ActivateServicePortal()
* ActivateModule()
* ActivateAppMenu()
* ActivateViewRule()
* ActivateACL()
* ActivateNotification()
* ShowFieldClass()
* ActivateRecord()
* InsertFieldToFormSection()
* RecordTransporterPackageUnpack()
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.
Performs an instance scan on an application using only a specific check.
Performs an instance scan on a record using only a specific check.
Runs a Instance Scan script only Check.
Based on a given encoded query string, the function returns the GlideRecord object of the requested Instance Scan check, false if the encoded query is unrelated to Instance Scan.
Based on the given class name and strTypeInstance Scan check GlideRecord object the function returns the encoded query to be added to a query for a sys_metadata derived record.
The encoded query shall prevent Instance Scan to load those records where the check will not provide any meaningful results.
Returns the result of an instance scan as a single object.
Returns true if an Instance Scan scan is currently running, false if not.
Returns true if the given check is a script check, false if not.
Performs an instance scan point scan on a specific record
Performs an instance scan on an application using a specific suite.
Performs an instance scan using a specific suite on an application and all of the apps dependencies.
Performs an instance scan on a record using a specific suite.
Returns true if DevTools is active, false if not.
The main driver is the system property "glide.record.legacy_cross_scope_access_policy_in_script".
Returns true if the given application is a "shared" application - i.e. whether it has a record in x_snc_devtools_shared_application pointing to it. False if not.
Returns true if the given value is an array. False if not.
Returns true if the given string is "camelCase", false if not.
Returns true if the given sys_dictionary record is a read-only "cloned" record of a "TTP" ("Table per Partition") table.
Returns true if the given table (provided as a string or a GlideRecord object) is derived from the given table, false if not.
Returns true if domain separtion is installed on the instance. Keep in mind, domain separation may or may not be active.
Checks if two values are equal. The function also supports arrays and can ignore the order of array elements while comparing.
Checks if the given record is really a GlideRecord object representing an existing record.
Returns true if the given value is a function. False if not.
Returns true if the given parameter is an integer value, returns false if not.
Returns true if the given string is "kebab-case", false if not.
Returns true if the given value is an object. False if not.
Returns true if the given string is "PascalCase", false if not.
Returns true if the given role is a persona role, false if not.
Returns true if Polaris is to be used for the current page and given or current sesison user.
Returns true if the given url is most likely related to the primary request of a page load. If there is an indicator of a secondary request (that is a request that is triggered by the inital page load) the function returns false.
Returns true if the given parameter is the name or the sys_id of an existing system property. False if not.
Returns true if the given string is "snake_case", false if not.
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.
Returns true if domain separation is supported and active on a given table, false if not.
If the given user is a "technical" user, the function returns true, otherwise false.
Returns true if an ATF test exists for the given record.
Returns true if the current execution context is an ATF test. False if not.
If the given user is a "test" user, the function returns true, otherwise false.
Returns true if the user is an admin user, false if not.
Returns true if the user sys_id represents the default OOTB admin user, false if not.
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.
Returns true if the current user session is associated with impersonated user.
Warning: Surprisingly the function returns true when executed in a scripted ATF test step.
Returns true if the current user operates as maint, false if not.
Returns true if the current user is elevated to security_admin, false if not.
Returns true of the given table column exists. False if not.
Returns true of the given string identifies a database view. False if not.
Returns true if the given string is a valid email, false if not.
Returns true of the given value is a valid function. False if not.
Checks if the given record is a valid glide record object. Returns true if it is, false if not.
Checks if the given string is a syntactically correct sys_id. Returns true if it is, false if not.
Considers special Sys IDs for fx_currency and the "Default view" in sys_ui_view.
Returns true of the given table exists. False if not.
Returns true if the given string contains a valid, fully qualified Url, false if not.
Returns true if the given string is a valid version number, false if not.
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.
Loads all local test messages for an "application".
Produces a log output
Produces a error log output
Produces a warning log output
Creates or updates the given group and ensures that only the given roles are assigned.
Creates a CSV file based on the given parameters.
Convers an object into a JSON string.
Returns a url parameter string based on the given parameters.
Returns a valid user (log) name without blanks, all lowercase based on the given string(s).
Merges two objects or arrays.
Parses a csv formatted string into an array of objects representing each row.
Parses a string and returns a time value.
Returns the components of an email as an object, false if the given string is not a valid email.
Parses a string and returns an object or false in case of failure (instead of pointlessly throwing an exception).
Parses a Url and returns its components as an object.
Parses a the Url parameters and returns the parameters as an object.
Parses a given xml string and returns an object if successful, otherwise false.
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.
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.
Prepares a payload for debug log output.
Prepares a payload for error log output.
Prepares a payload for info log output.
Prepares a payload for warning log output.
Turns all Evaluator errors (which are logged as warnings by the platform) into real errors.
The ProgressTracker class encapsulates the SNC.GlideExecutionTracker object for use within scoped applications.
|
Methods:
* initialize()
* IsInitialized()
* Start()
* SetPercentageProgress()
* SetText()
* SetResult()
Adds an attachment to a record.
Delets all attachments of a given record.
Delets all attachments of a given record that match a given the file name.
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.
Deletes a single record from a table. Returns true if the record could be deleted successfully.
Shorthand to get a single value from a record from a table based on its sys_id.
Inserts a new record into a table with the specified values if the columns exist.
Inserts or updates a record based on the given criteria.
The function managers the order field in a given table. The given Sys ID identifies the record for which a new order value should be set and respected by all other records. The new order value is the new position of the given record. If the new order value is beyond the total number of records in the table, the record will be placed at the end.
The Sys ID and new order parameters are optional. If null, an existing order will be maintained but the order values will be put in an exact sequence, if they are not already.
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.
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.
Saves the given record to the current Update Set.
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.
Retrieves the given Record Transporter Package by its Sys ID or ID.
Verifies if the given Record Transporter Package ID Suffix is valid.
Packs all sys_translated_text records referring to application file records contained in the given package scope.
Deletes all records from a Record Transporter Package but keeps track on the Sys IDs of the deleted records to enable delta deletions in future deliveries.
Unpacks a given record from a Record Transporter Package.
Packs a given record into a Record Transporter Package.
Unpacks a given record from a Record Transporter Package.
Redirects to the form view of the given record if it is valid.
Redirects to the given url if it is valid.
Renders an array as a text with delimiters between elements.
Returns a user-friendly number of bytes using KB, MB and GB where appropriate.
Renders the callstack for error reporting or logging purposes.
Renders the given date as an UTC iso string.
Renders a date/time value as an UTC ISO string.
Renders the given date/time according to the current user's preferences.
Provides detailed debug information.
Renders the execution schedule for a sysauto (derived) record.
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.
Renders the given time as an UTC iso string.
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.
Render a value as a hexadecimal string.
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.
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.
Returns a new description containing auto-generated documentation for the given script.
Empties all string literals contained in a script (a string).
Retrieves the names of all functions from the given script (or engine object).
A known deficiency is that anonymous functions erroneously return with the function name of the function that receives the function as a parameter.
Removes all comments in a script (a string).
Sends an email if the supplied params object contains non-empty values for "subject", "body" and "recipients" and if the "glide.email.smtp.active" system property is set to true.
The default sender name is defined in the system property "glide.email.username". It can be set using the "from" value in the params object.
Sets the maintainer (team) name, maintainer email address, documentation and repository url for the given application.
Sets the source code repository url for the given application.
Sets the current scope for the current user's session.
Sets a system property independent of its scope.
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.
Increases a value by the given amount in 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.
Sleeps for the given amount of seconds. This function serves as an alternative to gs.sleep() which is not supported in scoped apps.
Applies the remote changes from the current branch of given application.
If bAsync is set to false, the function operates synchronously and will NOT return until the operation is completed. The return false indicates success by returning true or failure by returning false.
If bAsync is true, the function will return the progress id of the triggered background process.
Commits all uncommitted changes to the currently active branch of the given application.
If bAsync is set to false, the function operates synchronously and will NOT return until the operation is completed. The return false indicates success by returning true or failure by returning false.
If bAsync is true, the function will return the progress id of the triggered background process.
Creates a new branch based on the currently active branch of the given application.
If bAsync is set to false, the function operates synchronously and will NOT return until the operation is completed. The return false indicates success by returning true or failure by returning false.
If bAsync is true, the function will return the progress id of the triggered background process.
Switches the given application to the given branch.
If bAsync is set to false, the function operates synchronously and will NOT return until the operation is completed. The return false indicates success by returning true or failure by returning false.
If bAsync is true, the function will return the progress id of the triggered background process.
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.
The StopWatch class measures time in the same way as a real stopwatch does.
Checks a given string against a regular expression.
Returns the index of the needle string within the haystack string, -1 if the needle is not contained in the haystack.
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.
Finds a string in a string based on a regular expression.
The function replaces numbered placeholders in the input string by the given parameters.
Returns the first matching string based on the given input string and the regular expression. The function returns false if no matching string could be found.
Equivalent of the JavaScript method padStart.
The function returns the input string with all characters removed that are contained in the blacklist string.
Replaces all occurences of a string by another string in a string.
Replaces multiple tokens in the given string. The tokens are passed in as an array of token objects that contain a key and a value member.
Replaces all matches of a regular expression by another string in a string.
Removes a trailing slash from a string - unless the string consist only of a single slash.
Sets an attribute of a table column to a given value.
Changes the parent table of the given table to a new parent table.
WARNING: This function is still experimental. Handle with great care.
Make sure your work is backed-up before use.
When running as a background script, unset the "Record for rollback" option - otherwise the function will not work!
Sets an attribute of a table to a given value.
The TestAPI class supports scripted tests.
|
Methods:
* initialize()
* Log()
* SetContext()
* SetResult()
* GetResult()
* TestCase_GetValue()
* TestCase_GetRecord()
* TestCase_GetRecord_CheckResult()
* TestCase_RecordGetValue()
* TestCase_IsRecordAccessibleByUser()
* TestCase_InstanceScanCheck()
* TestCase_InstanceScanCheck_CheckResult()
* TestCase_InstanceScanCheckScriptOnly()
* TestCase_InstanceScanCheckScriptOnly_CheckResult()
* TestCase_HttpRequest()
* TestCase_HttpRequest_CheckResult()
* TestCase()
A class to create test data records.
|
Methods:
* initialize()
* SetPrefix()
* GetPrefix()
* GetAllData()
* DeleteAllData()
* GetAllRecordsFromTable()
* DeleteAllRecordsByName()
* CreateRecord()
* GetRecord()
* CreateTestItem()
* GetAllTestItems()
* GetTestItem()
* CreateUser()
* GetAllUsers()
* GetUser()
* CreateGroup()
* GetAllGroups()
* GetGroup()
* CreateRole()
* GetAllRoles()
* GetRole()
* CreateCompany()
* GetAllCompanies()
* GetCompany()
* CreateContract()
* GetAllContracts()
* GetContract()
* CreateIncident()
* GetAllIncidents()
* GetIncident()
* CreateIncidentTask()
* GetAllIncidentTasks()
* GetIncidentTask()
* CreateChangeRequest()
* GetAllChangeRequests()
* GetChangeRequest()
* CreateChangeTask()
* GetAllChangeTasks()
* GetChangeTask()
* CreateProblem()
* GetAllProblems()
* GetProblem()
* CreateProblemTask()
* GetAllProblemTasks()
* GetProblemTask()
* CreateRequest()
* GetAllRequests()
* GetRequest()
* CreateRequestItem()
* GetAllRequestItems()
* GetRequestItem()
* CreateRequestTask()
* GetAllRequestTasks()
* GetRequestTask()
* GetAllConfigurationItems()
* GetConfigurationItem()
* CreateDatabaseView()
* GetDatabaseViewPrefix()
* GetDatabaseViewName()
* GetAllDatabaseViews()
* GetDataBaseView()
* CreateScriptInclude()
* GetAllScriptIncludes()
* GetScriptInclude()
* CreateServicePortalWidget()
* GetAllServicePortalWidgets()
* GetServicePortalWidget()
Adds (or substracts) a given number of days to (or from) a given time value (in milliseconds).
A class to manage the transaction cache.
|
Methods:
* initialize()
* SetContext()
* GetContext()
* SetItem()
* GetItem()
Deletes an update set including all its files.
Adds a role to a user if the user doesn't have the role already.
Impersonates a user based on a user's sys id.
Waits synchronously until the given progress reaches a final state.
Identifies business rules that run for the given tables in the different CRUD operations.
Adds a "Run Server Side Script" test step to the given test.
Client side user interface to baseline a new version for the given application.
Appends the second given array to the first.
Adds a value to an arry if it doesn't exist yet. Returns the resulting array.
Returns an array with unique values only.
Checks if a value exists in an array and returns true in that case, otherwise false.
Binds all functions of the given object to the given object. This is needed to access the "this" object within every function of the class. Javascript is inherently broken and the fact that this function is even necessary can serve as proof.
Creates a copy of the given value.
Produces a debug output.
Displays a modal dialog with "OK" and "Cancel" options. Returns true if the user clicks "OK", false if the user clicks on "Cancel".
Displays a modal message dialog.
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.
Displays a modal dialog with with a text input field. Returns the value that is entered by the user.
Opens the dialog to choose a test runner and runs a test.
Opens the dialog to choose a test runner and runs a test suite.
Formats all fields on the page: in the form, related lists or a list view according to the format configuration provided by the backend.
Renders a value based on a given configuration.
Returns an array no matter what input type is given and performs necessary conversion if another type is provided.
Returns either true or false no matter what kind of value is given.
Returns the frame's url.
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.
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.
Returns the current url.
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.)
Returns a float value.
Retrieves the format config using an ajax request and caches the response to avoid duplicate requests.
Retrieves the format config for multiple records using an ajax request.
Returns an object containing all field data of the current form, or false if the current page does not contain a form.
Gets an array with the names of all functions of a given object.
Returns the best available class to render a modal Glide dialog pop-up window - if there is any.
Returns the path to the form of the given table to create a new record.
Returns the url to the form of the given table to create a new record.
Generates a record's path.
Creates the URI for the given record
Returns an integer value.
Returns all key names of an object in an array. Returns an empty array if no object is provided or no members exist.
Retrieves a parameter supplied in the url.
Old deprecated version of GetParam().
Returns all properties of a given object or an empty array if the given value has no properties.
Returns a random boolean value, either true or false.
Returns a random float value.
Returns a random integer value.
Returns a string value in all cases. Arrays and objects are converted into comma separated strings.
Returns the number of millisenconds passed since the start of the unix epoch.
Returns the type of a value.
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.
Converts a string to html.
Identifies all records that are displayed on the current page by iterating over various html elements.
Called when a page is loaded to invoke DevTools features.
Returns true if an Instance Scan scan is currently running, false if not.
Returns true if the given value is an array. False if not.
Checks if two values are equal. The function also supports arrays and can ignore the order of array elements while comparing.
Returns true if the current page is a form, false if not.
Returns true if the form on the current page is dirty, false if not. Specify any fields that should be ignored when comparing the initial form field content with the curent state.
Returns true if the given value is a function. False if not.
Returns true if the given parameter is an integer value, returns false if not.
Returns true if the current page is a list, false if not.
Returns true if the given value is an object. False if not.
Returns true if the given string is a valid email, false if not.
Checks if the given string is a syntactically correct sys_id. Returns true if it is, false if not.
Returns true if the given string contains a valid, fully qualified Url, false if not.
Produces an error log output.
Produces an error log output.
Merges two objects or arrays.
Attaches a listening callback functon to a DOM element.
Parses a string and returns an object or false in case of failure (instead of pointlessly throwing an exception).
Parses a URL and returns its components as an object.
Parses a the URL parameters and returns the parameters as an object.
Redirects the browser to the given record - in the same tab/window or a new one depending on the given parameter.
Redirects the browser to the given URL - in the same tab/window or a new one depending on the given parameter.
Reloads the current page. If the parameter bNotIfDirty is set to true, a dirty form will not be reloaded. Specify any fields that should be ignored when comparing the initial form field content with the curent state.
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.
Performs an ajax request (either synchronous or asynchronous) to a defined API and function.
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.
Client side user interface to baseline the current version for the given shared application.
Checks a given string against a regular expression.
The function returns the input string with all characters removed that are contained in the blacklist string.
DevTools contains the following customized test step configurations:
Checks if all documented dependencies are installed in a compatible version.
Checks if another required application is installed in a supported version.
Performs a sanity check on a scoped app. E.g. it checks if all contained system properties are not set private and all tests have an empty copied_from field.
Checks if the given table is configured for full cross scope access.
Checks if there are remainders of test data from previous tests based on a given test data prefix.
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; }, GetApplicationStatus: function(status) { var IsValidFunction = x_snc_devtools.IsValidFunction; if (IsValidFunction(x_this_app_scope.DevToolsGetApplicationStatus)) { status = DevToolsGetApplicationStatus(status); } return status; }, RenderDebugDump: function() { var IsValidFunction = x_snc_devtools.IsValidFunction; var strDebug = ''; if (IsValidFunction(x_this_app_scope.DevToolsRenderDebugDump)) { strDebug = x_snc_devtools.GetStringValue(DevToolsRenderDebugDump()); } return strDebug; }, GetInstancePipelineName: function(strInstanceName) { var IsValidFunction = x_snc_devtools.IsValidFunction; var strInstancePipelineName = ''; if (IsValidFunction(x_this_app_scope.DevToolsGetInstancePipelineName)) { strInstancePipelineName = x_snc_devtools.GetStringValue(DevToolsGetInstancePipelineName(strInstanceName)); } return strInstancePipelineName; }, GetEncodedQueryToPreventUselessChecks: function(rules) { var IsValidFunction = x_snc_devtools.IsValidFunction; if (IsValidFunction(x_this_app_scope.GetEncodedQueryToPreventUselessChecks)) { return GetEncodedQueryToPreventUselessChecks(rules); } return rules; }, type: 'DevTools' };
Hide inactive portals.
Sets the actual table field based on the free text table field.
Sets the x_snc_devtools_table field if it is empty
Sets the actual table field based on the free text table field.
Display a message that informs the developer on how to set a table from another scope.
Copies the repository url from the sys_repo_config record associated to an app to the app record itself. This is to keep the information about an app's repo in the repo itself. By that it can be used in documentation and logic that looks into a source control directly.
If the system property "x_snc_devtools.ui.force_scope" is set to true, the current scope is set to the scope of the application when loading its form. This is to avoid the annoying message about being in the wrong scope.
Warn admins if the application contains records with credentials.
Synchronizes the data in the dependency record with the corresponding app before displaying the application form.
Ensures that the record that marks an ATF test's association to a suite has the same scope as the ATF suite.
Implements the workaround to the issue described in KB0998966.
Prevents unnecessary Instance Scan checks from running. This reduces scan time significantly.
If the system property "x_snc_devtools.ui.force_scope" is set to true, the current scope is set to the scope of the record when loading a form. This is to avoid the annoying message about being in the wrong scope.
Warn admins if the current application contains records with credentials.
Display the evaluator errors (warnings) that occured within a configurable time span.
If the sys_scope is not global and the sys_package differs from the sys_scope value, sys_package synchronized with the sys_scope value. This situation is caused by moving a global scope record into a global scoped application. If sys_scope and sys_package differ, the record may not be scanned by Instance Scan.
If the table of a Client Script is not set, set the table to "global". This is prevented by the OOTB GUI.
Adds auto-generated documentation to the description.
If the UI Action's table is not set, it is set to "global" - to make the UI Action accessible on all table forms or lists. Setting the table to "global" is prevented by the GUI OOTB.
Sets the global flag for global UI scripts in scoped applications.
Sorts the workspaces by their names.
Updates several fields of the CI based on the "app_" fields.
Prevents adding duplicate dependencies.
Synchronizes data from an app or package into the corresponding Dependency record if possible.
Verifies and sets the ID for the Transporter Package.
Sets the display value of the Transport Record.
This app does not have any dependencies.
A number of functions use uppercase "URL" in their name, other use camel cased "Url" which is more consistent with the overall function naming scheme. Such functions must be renamed and proxy functions should be introduced for backward compatibility until DevTools version 2.0.
GetInstance(New)Record(Uri|Path)() functions (Script Include and UI Scripts) are deprecated and should be replaced by functions following this naming schema: Get(New)Record*().
Functions starting with "GetInstance" must include the instance url.
The function GetInstanceRecordPath() is deprecated and replaced by function GetRecordUri().
The function GetInstanceRecordURI() is deprecated and replaced by function GetRecordUri().
The function name IsTechnicalUser() is inconsistent with other functions names like IsUserAdmin() or IsUserMaint()
The UI action "Save" and the deactivated business rule "sysrule_view - show hint to set table" are remainders of an old way to help admins creating cross scope sysrule_view records.
Once the new feature is confirmed, the code should be removed.
The function RenderDateTimeUser() does not work properly. This requires investigation and a solid testing strategy as the output depends on dynamic user settings.
The test "DevTools - sys_metadata - Prevent useless checks" randomly fails when executed in the DevTools test suite via the GUI.
However when executed separately, the test always passes.
Older test scripts are still not using TestAPI.
The field "switch" is no longer compliant with CodeSanity rules - as the term may eventually clash with JavaScript reserved terms when used in a script. A strategy must be identified to rename the field - considering that it may be used by other applications.
Copyright 2020-2024 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.
var grDept = new GlideRecord('x_snc_devtools_technical_dept'); grDept.query(); while (grDept.next()) { x_snc_devtools.Log(grDept); RecordQueryOrInsert('x_snc_devtools_technical_debt', { sys_scope: grDept.sys_scope, id: grDept.id }, { short_description: grDept.short_description, switch: grDept.switch }, false); }
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();
First baselined version