Skip to content

Latest commit

 

History

History
2917 lines (2274 loc) · 128 KB

File metadata and controls

2917 lines (2274 loc) · 128 KB

Objects

AccessRequestApproverUpdate : object

Handles functionality for the AccessRequestApproverUpdate catalog item

ApplicationAccessRequestUtils : object

Application Access request utilities

ApprovalRetriever : object

Retrieves approvals based on the ci

ApprovalUtil : object

Generates custom email text for approval or requested item emails

AppsAndServices : object

Populates the services and watch list based on the business application field on the incident form

AppServiceUtil : object

Handles app/service relationships for the incident form

Assertions : object

Contains assertions for running unit tests

AttachmentChecker : object

Checks the current record for attachments

BlockCertainEmailsUtil : object

Contains various utilities for dealing with blocked emails Also finds the source email in the header field of a current object of a business Rule that hits the sys_email table, because for some reason, finding out who it's from directly isn't something the current object wants to do, outside of an inbound action of course.

CatalogClassCreator : object

Creates classes for Selenium automated browser testing

ChangeManagementCIReference : object

Sets the CI reference qualifier for the Change Request Table based on the type of change request

ChangeManagementUtil : object

Useful for server side CM functionality

ChangeTasker : object

A class for handling change tasks

ChatAlerts : object

Polls the system for Chat Messages

ClassCreator : object
InboundEmailTicketUtil : object

This is a class that contains all the utilities to handle Inbound Emails sent with the intent of creating new incident tickets.

ModelClassCreator : object

Creates Model Classes for RESTful services

OnboardingUtil : object

Contains functions for onboarding

ProposedChangeHandler : object

Provides functionality for discovering information about proposed changes, can handle multiple proposed changes per change request

ReworkCancellation : object

Handles the cancellation of reworked Requested Items

ReworkUtil : object

Handles functionality for rework

ScheduleNewHolidaysUtil : object

This contains the method needed to insert new or update holiday records

SecurityAccessUtil : object

Handles checks for Security Access Requests

ServiceAccount : object

Allows for the creation of users that are useful for service accounts, so they can access web services from ServiceNow

ServiceCatalogUtils : object

Utilities for general Service Catalog items: requests, requested items, etc.

SNFormatter : object

Contains functions to format values properly, such as money, strings, titles, etc.

SNUnit : object

Runs back-end unit tests in ServiceNow

SNValidator : object

Validates arguments for ServiceNow classes

SNVariableUtil : object

Contains functionality that handles service catalog variables or other dictionary items

UserAndGroupUtils : object

Utility functions for users and groups

VariableClearer : object

There are times when variables on a ritm need to be cleared due to users changing options without clearing them. Using g_form.setValue('name', '') will not work on the client side because the form needs the sys_id (with ni.VE prepended) to identify the element on the form

## AccessRequestApproverUpdate : object Handles functionality for the AccessRequestApproverUpdate catalog item

Kind: global namespace
Extends: AbstractAjaxProcessor
See: SNValidator

AccessRequestApproverUpdate.getApprovers() ⇒ string

AJAX function to return approvers to the client form

Kind: static method of AccessRequestApproverUpdate
Returns: string - - a String/Array of approver sys_ids

Type Description
string A sys_id from the form

AccessRequestApproverUpdate.getAllowedGroups() ⇒ Array

returns an array groups who are allowed to view the catalog item

Kind: static method of AccessRequestApproverUpdate
Returns: Array - A list of group names

AccessRequestApproverUpdate.accessAllowed() ⇒

Determines if a user can access the catalog item

Kind: static method of AccessRequestApproverUpdate
Returns: - true if the user can access it

AccessRequestApproverUpdate.updateApprovers(current) ⇒

Given a requested item, updates the related catalog approver entry

Kind: static method of AccessRequestApproverUpdate
Returns: true if the update was successful; false otherwise

Param Type Description
current GlideRecord a requested item glide record

AccessRequestApproverUpdate.isCatalogItemSOX(current) ⇒ boolean

Determines if the catalog item relates to a sox application

Kind: static method of AccessRequestApproverUpdate
Returns: boolean - - true if the catalog item relates to a sox application

Param Type Description
current GlideRecord the current requested item

AccessRequestApproverUpdate.cleanName(name) ⇒ string

converts the name to match a CMDB entry - Currently Many are wrong or have multiple possibilities

Kind: static method of AccessRequestApproverUpdate
Returns: string - the cleaned up name

Param Type Description
name string The name of the catalog item

ApplicationAccessRequestUtils : object

Application Access request utilities

Kind: global namespace

applicationAccessRequestUtils.getSecurityAccessRequestUser(current) ⇒ String

Determines what type of user the request is for, then returns that user

Kind: instance method of ApplicationAccessRequestUtils
Returns: String - The name of the user requested for

Param Type Description
current GlideRecord The current record

applicationAccessRequestUtils.getCurrentApplication(current) ⇒ String

Returns the name of the current category item

Kind: instance method of ApplicationAccessRequestUtils
Returns: String - the name of the category item, which is an application

Param Type Description
current GlideRecord the current record

applicationAccessRequestUtils.getHiringManager(gr)

Gets the Hiring Manager on the RITM

Kind: instance method of ApplicationAccessRequestUtils

Param Type Description
gr GlideRecord The sc_req_item glide record

applicationAccessRequestUtils.getRequestedFor(gr)

Gets the "Requested For" on the RITM

Kind: instance method of ApplicationAccessRequestUtils

Param Type Description
gr GlideRecord The sc_req_item glide record

applicationAccessRequestUtils.reworkReminder()

Fires off a rework notification if the item has not be reworked in a specified period of time. If the item has not been updated in 30 days, it is automatically rejected

Kind: instance method of ApplicationAccessRequestUtils
See: ScheduledJob

applicationAccessRequestUtils.approvalReminder()

Checks for Access Request approvals that are idle. If they are idle for 30 days, they are automatically rejected. If they are idle for 15 days, a reminder is sent. The times can be changed via system properties on the Service Catalog system properties page

Kind: instance method of ApplicationAccessRequestUtils

ApprovalRetriever : object

Retrieves approvals based on the ci

Kind: global namespace

approvalRetriever.initialize(current)

Sets some class variables

Kind: instance method of ApprovalRetriever

Param Type Description
current GlideRecord the current record (typically a change request)

approvalRetriever.getApproversByFieldFromCI(fieldName, ci) ⇒ array

Gets an approver or group of approvers from a given field on a given ci

Kind: instance method of ApprovalRetriever
Returns: array - an array of approvers

Param Type Description
fieldName string the name of a field
ci GlideRecord the sys_id of a configuration item

approvalRetriever.trySplittingValues(value) ⇒ array

Wraps the attempt to split an array into a try catch block

Kind: instance method of ApprovalRetriever
Returns: array - either the string split by comma, or an empty array

Param Type Description
value string a string to split into an array

approvalRetriever.removeCIApprovers()

Removes any default approvers from the approval list for a task

Kind: instance method of ApprovalRetriever
Example

var ar = new ApprovalRetriever(current); 
if (current.type == "Std-Application") {
	ar.removeCIApprovers();		
}

approvalRetriever.resetNonCIApprovers(state)

Resets approvals to a given state

Kind: instance method of ApprovalRetriever

Param Type Description
state string the state to set the approvals

Example

var ar = new ApprovalRetriever(current);
ar.resetNonCIApprovers('not requested');

approvalRetriever.removeNonCIApprovers()

Completely removes an approval record

Kind: instance method of ApprovalRetriever
Example

var ar = new ApprovalRetriever(current);
ar.removeNonCIApprovers();

approvalRetriever.removeInfrastructureApprovers()

Removes and resets approvals on infrastructure

Kind: instance method of ApprovalRetriever
Example

var ar = new ApprovalRetriever(current);
else {
    ar.removeInfrastructureApprovers();
}

approvalRetriever.removeEmergencyApprovers()

Removes and resets Emergency approvals

Kind: instance method of ApprovalRetriever
Example

var ar = new ApprovalRetriever(current);
if (current.type == "Emergency") {
	ar.removeEmergencyApprovers();
}

approvalRetriever.resetProposedChangeApprovers()

Resets approvals related to proposed changes

Kind: instance method of ApprovalRetriever
Example

var ar = new ApprovalRetriever(current);
if (NonAppliedProposedChangesExist(current)) {
	ar.resetProposedChangeApprovers();
}

ApprovalUtil : object

Generates custom email text for approval or requested item emails

Kind: global namespace
Extends: SNVariableUtil
See

  • SNValidator
  • SNFormatter
  • OnboardingUtil
  • SercurityAccessUtil
  • ServiceCatalogUtils

ApprovalUtil.initialize()

Creates an ApprovalUtil object

Kind: static method of ApprovalUtil

ApprovalUtil.getCustomFields() ⇒ string

Processes the custom fields needed for an approval email

Kind: static method of ApprovalUtil
Returns: string - a result list, containing questions and their values
Example

//Inside an Email Notification's mail script tag
var approvalUtil = new ApprovalUtil(current.sysapproval);
template.print(approvalUtil.getCustomFields());

ApprovalUtil.determineVariables()

Sets the variables list for the class

Kind: static method of ApprovalUtil

ApprovalUtil.handleNeededVariables(sc)

process

Kind: static method of ApprovalUtil

Param Type Description
sc GlideRecord The Catalog Variable Glide Record

ApprovalUtil.handleReturn() ⇒ string

finalizes the process and returns the final results

Kind: static method of ApprovalUtil
Returns: string - a string contain information about the variables in the request

ApprovalUtil.reorderResult() ⇒ string

Reorders the results from the query into the correct field order so it can be printed neatly in an email

Kind: static method of ApprovalUtil
Returns: string - a string that contains proper output

ApprovalUtil.getVariables(argument) ⇒ array

gets the variable list associated with the catalog item

Kind: static method of ApprovalUtil
Returns: array - an array containing variables (questions) to look for

Param Type Description
argument string includes any extra text to add to the system property

ApprovalUtil.isReworkable() ⇒ boolean

Determines if a catalog item is reworkable

Kind: static method of ApprovalUtil
Returns: boolean - true if the catalog item is reworkable; false otherwise

AppsAndServices : object

Populates the services and watch list based on the business application field on the incident form

Kind: global namespace
Extends: AbstractAjaxProcessor

AppsAndServices.getService(sysparm_app, sysparm_ci) ⇒ string

Uses the relationship table to get services related to an application. Typically, this is a 1:M relationship (Service:App), so it should return just one service

Kind: static method of AppsAndServices
Returns: string - The Service(s) associated with the application

Param Type Description
sysparm_app string AJAX parameter - a comma delimited list value
sysparm_ci string AJAX parameter - the sys_id of a ci

AppsAndServices.getApplication(sysparm_service) ⇒ string

Uses the relationship table to get applications related to a service

Kind: static method of AppsAndServices
Returns: string - a list of applications related to given services

Param Type Description
sysparm_service string AJAX parameter - a comma delimited list of services

AppsAndServices.watchLister(sysparm_app) ⇒ string

Returns a list of users based on the applications passed in via AJAX. Note: The client side handles whether or not the user is removed, or users are added

Kind: static method of AppsAndServices
Returns: string - A string of users, comma delimited

Param Type Description
sysparm_app string AJAX parameter - a comma delimited list value

AppsAndServices.ciPopulator(sysparm_app, sysparm_ci, sysparm_service) ⇒ string

Searches the Relationship table to find any relations between server CIs and business services

Kind: static method of AppsAndServices
Returns: string - a list of app/service relationships

Param Type Description
sysparm_app string AJAX parameter - a comma delimited list value
sysparm_ci string AJAX parameter - the sys_id of a ci
sysparm_service string AJAX parameter - a comma delimited list of services

AppsAndServices.ciRemover(sysparm_oldci) ⇒ string

Used when the CI changes to empty. Returns all of the old apps so they can be removed.

Kind: static method of AppsAndServices
Returns: string - a list of applications related to that ci

Param Type Description
sysparm_oldci string The sys_id of a ci that's being removd from the form

AppsAndServices.ciRemoverService(sysparm_oldci) ⇒ string

removes services when the ci changes to empty

Kind: static method of AppsAndServices
Returns: string - a list of services related to that ci

Param Type Description
sysparm_oldci string The sys_id of a ci that's being removd from the form

AppServiceUtil : object

Handles app/service relationships for the incident form

Kind: global namespace
See: ArrayUtil

appServiceUtil.initialize()

Ensures there's an instance of ArrayUtil available

Kind: instance method of AppServiceUtil

appServiceUtil.getWatchListForApps(previous, current) ⇒ string

Finds the managers of the applications

Kind: instance method of AppServiceUtil
Returns: string - The new watch list as a string

Param Type Description
previous GlideRecord The Previous Version of the record
current GlideRecord The Current version of the record about to be saved

appServiceUtil.getManagers(application) ⇒ array

Gets managers related to applications

Kind: instance method of AppServiceUtil
Returns: array - an array of managers

Param Type Description
application array An array of applications

appServiceUtil.getBusinessServices(apps) ⇒ array

Queries the Relationship table to find what services an application is related to

Kind: instance method of AppServiceUtil
Returns: array - a list of services associated with the applications passed in

Param Type Description
apps array A list of applications to use as a query parameter

appServiceUtil.getBusinessApplications(services) ⇒ array

Queries the Relationship table to find what services an application is related to

Kind: instance method of AppServiceUtil
Returns: array - a list of applications associated with the services passed in

Param Type Description
services array A list of services to use as a query parameter

appServiceUtil.syncCMDBCI(current, previous)

Takes the value of the CI and gets the related applications and services

Kind: instance method of AppServiceUtil

Param Type Description
current GlideRecord the current record
previous GlideRecord the previous record

Assertions : object

Contains assertions for running unit tests

Kind: global namespace

assertions.results : Object

An object containing an array of results

Kind: instance property of Assertions

assertions.initialize(tableName, functionName, testName)

runs on initialization of the object

Kind: instance method of Assertions

Param Type Description
tableName string A table name for what is being tested
functionName string The name of the function or class being tested
testName string The name of the test

assertions.setFunctionName(functionName)

Sets the name of the function being tested

Kind: instance method of Assertions

Param Type Description
functionName string The name of the function or class being tested

assertions.setTableName(tableName)

Sets the name of the table being tested

Kind: instance method of Assertions

Param Type Description
tableName string The name of the table being tested

assertions.setTestName(testName)

sets the name of the test

Kind: instance method of Assertions

Param Type Description
testName string The name of the test

assertions.assertEqual(expected, actual, message)

Asserts that a value is equal to what is expected (==)

Kind: instance method of Assertions

Param Type Description
expected any A value that is expected
actual any The actual value
message string A message describing the test

Example

assert.assertEqual(1, 1, '1 ?== 1'); //true
assert.assertEqual(1, 2, '1 ?== 2'); //false

assertions.assertDeepEqual(expected, actual, message)

assertDeepEqual Asserts that a value is equal to what is expected (===)

Kind: instance method of Assertions

Param Type Description
expected any A value that is expected
actual any The actual value
message string A message describing the test

Example

assert.assertDeepEqual('1', 1, 'String of 1 equals 1?'); //false
assert.assertDeepEqual(1, 1, 'Number 1 equals Number 1?'); //true

assertions.assertNotEqual(expected, actual, message)

Asserts that a value is not equal to an expected value (!=)

Kind: instance method of Assertions

Param Type Description
expected any A value that is expected
actual any The actual value
message string A message describing the test

Example

assert.assertNotEqual('Pie', 'Cake', 'Cake does not equal Pie'); //true
assert.assertNotEqual(1, 1, 'One does not equal One?'); //false

assertions.assertDeepNotEqual(expected, actual, message)

Asserts that a value is not equal to an expected value (!==)

Kind: instance method of Assertions

Param Type Description
expected any A value that is expected
actual any The actual value
message string A message describing the test

Example

assert.assertDeepNotEqual('Pie', 'Cake', 'Cake does not equal Pie'); //true
assert.assertDeepNotEqual(1, 1, 'One does not equal One?'); //false

assertions.assertThrows(block, message)

Asserts that an exception is thrown by a function

Kind: instance method of Assertions

Param Type Description
block function A block of code to execute
message string A message describing the test

Example

assert.assertThrows(function() { throw 'help'; }, 'This function throws "help"'); //true

assertions.assertTrue(value, message)

Asserts that a value is true

Kind: instance method of Assertions

Param Type Description
value any A value to test
message string A message describing the test

Example

assert.assertTrue(1 == 1, 'One equals One?'); //true
assert.assertTrue(1 == 2, 'One equals Two?'); //false

assertions.assertFalse(value, message)

Asserts that a value is false

Kind: instance method of Assertions

Param Type Description
value any A value to test
message string A message describing the test

Example

assert.assertFalse(1 == 1, 'One equals One?'); //false
assert.assertFalse(1 == 2, 'One equals Two?'); //true

assertions.pass(message)

Handles the passing of a test

Kind: instance method of Assertions

Param Type Description
message string A message describing the test

assertions.fail(message)

Handles the failure of a test

Kind: instance method of Assertions

Param Type Description
message string A message describing the test

assertions.cleanUpMessage(message) ⇒ string

cleanUpMessage Cleans up the message; returns '' if nothing was passed in

Kind: instance method of Assertions
Returns: string - A cleaned up message

Param Type Description
message string A message describing the test

assertions.createResultRecord(message, flag)

Logs the result to a table in ServiceNow

Kind: instance method of Assertions

Param Type Description
message string A message describing the test
flag boolean Whether or not the test passed

AttachmentChecker : object

Checks the current record for attachments

Kind: global namespace

AttachmentChecker.checkAttachments(sysparm_record) ⇒ boolean

Checks a task record for attachments

Kind: static method of AttachmentChecker
Returns: boolean - true if the record has attachments; false if it does not

Param Type Description
sysparm_record string the sys_id of a task record

BlockCertainEmailsUtil : object

Contains various utilities for dealing with blocked emails Also finds the source email in the header field of a current object of a business Rule that hits the sys_email table, because for some reason, finding out who it's from directly isn't something the current object wants to do, outside of an inbound action of course.

Kind: global namespace

blockCertainEmailsUtil.checkBlockedEmail(emailName) ⇒ boolean

Checks to see whether or not the email passed is an email in the "blocked list" of a given application

Kind: instance method of BlockCertainEmailsUtil
Returns: boolean - true if the email is blocked; false if it's not blocked

Param Type Description
emailName string The email address

blockCertainEmailsUtil.trimOutFrom(header) ⇒ string

trims out the From part of an email header

Kind: instance method of BlockCertainEmailsUtil
Returns: string - who the email is from

Param Type Description
header string the header of an email

CatalogClassCreator : object

Creates classes for Selenium automated browser testing

Kind: global namespace

catalogClassCreator.initialize(camelCaseVariables, language)

Initalizes values for the running of the script

Kind: instance method of CatalogClassCreator

Param Type Description
camelCaseVariables string True for camelCase; false for non_camel_case
language string Which programming language

catalogClassCreator.processServiceCatalog()

The entry point to the script

Kind: instance method of CatalogClassCreator

catalogClassCreator.getServiceCatalogVariables(catalogItem) ⇒ string

Searches the variable table for variables associated with a Catalog Item

Kind: instance method of CatalogClassCreator
Returns: string - A class to add to the database

Param Type Description
catalogItem string The name of a catalog item

catalogClassCreator.generateClass(data, itemName) ⇒ string

Generates a class based on the catalog item

Kind: instance method of CatalogClassCreator
Returns: string - a class to add to the database

Param Type Description
data string a list of variables
itemName string a catalog item

catalogClassCreator.capitalizeFirstLetter(word) ⇒ string

Capitalizes the first letter in a word

Kind: instance method of CatalogClassCreator
Returns: string - The word with the first character capitalized

Param Type Description
word string A word to alter

catalogClassCreator.replaceUnderscoresWithCamelCase(item) ⇒ string

  • Replaces "_" to make a word camelCase

Kind: instance method of CatalogClassCreator
Returns: string - The passed in name in camelCase format

Param Type Description
item string A catalog item name

catalogClassCreator.replaceSpaces(item) ⇒ string

Replaces whitespace and non-word characters in a Catalog Iten name so it's a valid class name

Kind: instance method of CatalogClassCreator
Returns: string - The name without spaces or non-word characters

Param Type Description
item string A catalog item name

catalogClassCreator.getVariableSets(catalogItem) ⇒ array

Gets a list of variables in the variable set based on a catalog item

Kind: instance method of CatalogClassCreator
Returns: array - An array of sys_ids of the variables in a variable set associated with the catalog item

Param Type Description
catalogItem string The name of a catalog item

catalogClassCreator.getJavaVariables(gr) ⇒ array

Generates variables for the Java programming language

Kind: instance method of CatalogClassCreator
Returns: array - An array containing the new variables

Param Type Description
gr GlideRecord Glide Record containing variable information

catalogClassCreator.getJavascriptVariables(gr) ⇒ array

Generates variables for the Javascript programming language

Kind: instance method of CatalogClassCreator
Returns: array - An array containing the new variables

Param Type Description
gr GlideRecord Glide Record containing variable information

catalogClassCreator.getCSharpVariables(gr) ⇒ array

Generates variables for the C# programming language

Kind: instance method of CatalogClassCreator
Returns: array - An array containing the new variables

Param Type Description
gr GlideRecord Glide Record containing variable information

catalogClassCreator.getPythonVariables(gr) ⇒ array

Generates variables for the Python programming language

Kind: instance method of CatalogClassCreator
Returns: array - An array containing the new variables

Param Type Description
gr GlideRecord Glide Record containing variable information

catalogClassCreator.getRubyVariables(gr) ⇒ array

Generates variables for the Ruby programming language

Kind: instance method of CatalogClassCreator
Returns: array - An array containing the new variables

Param Type Description
gr GlideRecord Glide Record containing variable information

ChangeManagementCIReference : object

Sets the CI reference qualifier for the Change Request Table based on the type of change request

Kind: global namespace

ChangeManagementUtil : object

Useful for server side CM functionality

Kind: global namespace
Extends: AbstractAjaxProcesseor

ChangeManagementUtil.isEmergencyPreApprovalComplete()

Checks to see if the emergency pre approval is complete, so we don't show an unnecessary message

Kind: static method of ChangeManagementUtil

ChangeManagementUtil.eliminateWorkflow(current)

Deletes the current workflow

Kind: static method of ChangeManagementUtil

Param Type Description
current GlideRecord The current change request

ChangeManagementUtil.isUserInGroup(sysparm_user) ⇒ boolean

In the instance where an Assignment Group/Assigned to is set in the Std-Application form, the Infrastructure type change will change the AG but not the Assigned to. We need to ensure that the person is removed from AG if they aren't in the group

Kind: static method of ChangeManagementUtil
Returns: boolean - true if the user is a member of a group

Param Type Description
sysparm_user string The sys_id of a user

ChangeManagementUtil.isServerBuild(type) ⇒ boolean

Tells us if this is a server build

Kind: static method of ChangeManagementUtil
Returns: boolean - true if it's a server build

Param Type Description
type string The change type

ChangeManagementUtil.wereWorkNotesDone(sysparm_task) ⇒ boolean

Determines if there were work notes done on a record

Kind: static method of ChangeManagementUtil
Returns: boolean - true if there were worknotes for the given record

Param Type Description
sysparm_task String a sys_id of a task record

ChangeManagementUtil.checkApprovalCountInWorkflowStageOne(current, comparison) ⇒ string

Checks the approval status of a change request

Kind: static method of ChangeManagementUtil
Returns: string - 'approved' if the total = approved; 'rejected' if there is one rejection; '' otherwise

Param Type Description
current GlideRecord the current record (Change Request)
comparison Array a list of users that were original approvers

ChangeManagementUtil.checkApprovalCountInWorkflowStageTwo(current, comparison) ⇒ string

Checks the approval status of a change request

Kind: static method of ChangeManagementUtil
Returns: string - 'approved' if the total = approved; 'rejected' if there is one rejection; '' otherwise

Param Type Description
current GlideRecord the current record (Change Request)
comparison Array a list of users that were original approvers

ChangeManagementUtil.checkCMPhaseApproval(current, changeApproversTotal-) ⇒ string

Checks the approval status of a change request during the phase 2 approval

Kind: static method of ChangeManagementUtil
Returns: string - 'approved' if the total = approved; 'rejected' if there is one rejection; '' otherwise

Param Type Description
current GlideRecord the current record (Change Request)
changeApproversTotal- Array the number of change approvers - based on the CI or CM group

ChangeManagementUtil.checkApprovalCountInWorkflow(current) ⇒ string

Checks the approval status of a change request

Kind: static method of ChangeManagementUtil
Returns: string - 'approved' if the total = approved; 'rejected' if there is one rejection; '' otherwise
Depricated:

Param Type Description
current GlideRecord the current record (Change Request)

ChangeManagementUtil.checkPhaseTwoApproval(current, changeApproversTotal-) ⇒ string

Checks the approval status of a change request during the phase 2 approval

Kind: static method of ChangeManagementUtil
Returns: string - 'approved' if the total = approved; 'rejected' if there is one rejection; '' otherwise
Depricated:

Param Type Description
current GlideRecord the current record (Change Request)
changeApproversTotal- integer the number of change approvers - based on the CI or CM group

ChangeManagementUtil.isCM(approver) ⇒ boolean

Determines if the approver is a change manager. We only want the Change manager's approval to count once during phase 2

Kind: static method of ChangeManagementUtil
Returns: boolean - true if the user is a member of the change management group

Param Type Description
approver string The sys_id of an approver

ChangeManagementUtil.seeIfRegularApproverIsRemoved(approvalGR, comparison) ⇒ boolean

checks the approvals to see if the default approver(s) have been removed

Kind: static method of ChangeManagementUtil
Returns: boolean - true if all the original approvers are removed; false if they are still there

Param Type Description
approvalGR GlideRecord GlideRecord containing approvers
comparison Array an array of approvers

ChangeManagementUtil.isPredefined(current) ⇒ boolean

Determines if a task is one from the workflows

Kind: static method of ChangeManagementUtil
Returns: boolean - true if it's predefined; false if it's a custom task

Param Type Description
current GlideRecord the task record to check

ChangeManagementUtil.reschedule(current) ⇒ GlideRecord

Reschedules a backed out change request

Kind: static method of ChangeManagementUtil
Returns: GlideRecord - The child change request to redirect the form to

Param Type Description
current GlideRecord The change request to copy

ChangeManagementUtil.copyChangeTasks(current, childChange)

Copies custom change tasks from a backedout change to its child

Kind: static method of ChangeManagementUtil

Param Type Description
current GlideRecord the current change request record
childChange GlideRecord the child record

ChangeManagementUtil.copyAffectedCIs(current, the)

Copies affected ci records from a parent change to the child change

Kind: static method of ChangeManagementUtil

Param Type Description
current GlideRecord the current change request record
the GlideRecord child record

ChangeManagementUtil.copyImpactedServices(current, the)

Copies impacted services records from a parent change to the child change

Kind: static method of ChangeManagementUtil

Param Type Description
current GlideRecord the current change request record
the GlideRecord child record

ChangeManagementUtil.checkForAllChangeTasksClosed(changeRequestSysID)

Checks to see if all change tasks are closed. If so, sets a variable to be true

Kind: static method of ChangeManagementUtil

Param Type Description
changeRequestSysID string a sys_id of a change request

ChangeManagementUtil.updateChangeTasksClosedField(changeRequestSysID, action)

Performs the action of updating the change request to tell if all tasks are closed

Kind: static method of ChangeManagementUtil

Param Type Description
changeRequestSysID string a sys_id of a change request
action boolean the true/false value to update the change request with

ChangeTasker : object

A class for handling change tasks

Kind: global namespace

changeTasker.initialize(change)

initializes values for the class

Kind: instance method of ChangeTasker

Param Type Description
change GlideRecord Change Request

changeTasker.runOnScheduled()

Main Method for when a change request moves into "Scheduled" LCS

Kind: instance method of ChangeTasker

changeTasker.runOnNewChange()

Main Method for New Changes

Kind: instance method of ChangeTasker

changeTasker.runOnTypeChange()

Runs if the type of a change request is changed

Kind: instance method of ChangeTasker

changeTasker.runOnUpdate()

Compares current change tasks with a list of sox change tasks to see if any need to be generated

Kind: instance method of ChangeTasker

changeTasker._getBaseTasks() ⇒ array

Queries the custom tasks table for tasks based on change type and ci

Kind: instance method of ChangeTasker
Returns: array - an array of tasks data

changeTasker._getSoxTasks() ⇒ array

runs to deal with SOX related change requests

Kind: instance method of ChangeTasker
Returns: array - an array of tasks data

changeTasker.getCurrentTasks() ⇒ GlideRecord

Gets a list of change tasks given a change request

Kind: instance method of ChangeTasker
Returns: GlideRecord - the change tasks related to a change

changeTasker._deleteOldTasks()

Deletes all change tasks related to the current change request, but only if they are inactive

Kind: instance method of ChangeTasker

changeTasker._createNewTasks()

Creates new tasks for a change request

Kind: instance method of ChangeTasker

changeTasker._shouldSOXTasksBeMade() ⇒ boolean

Conditional for when SOX change tasks should be created

Kind: instance method of ChangeTasker
Returns: boolean - true if the CI is SOX governed and the change request uses SOX project framework

changeTasker.resetEmergencyApprovalTask()

Resets the emergency approval task to open

Kind: instance method of ChangeTasker

changeTasker.isEmergencyGoingBack() ⇒ boolean

Conditional for a Business Rule: true if the emergency change request moves from Scheduled to Draft

Kind: instance method of ChangeTasker
Returns: boolean - true if the change request is emergency and moves back to Draft from Scheduled

changeTasker.isInfrastructureScheduled() ⇒ boolean

isInfrastructureScheduled Conditional for a business rule: true if it's an infrastructure record moving to scheduled

Kind: instance method of ChangeTasker
Returns: boolean - true if the change request is infrastructure and scheduled

changeTasker.isNonInfrastructureCreated() ⇒ boolean

Conditional for a business rule: true if it's a new non-infrastructure record

Kind: instance method of ChangeTasker
Returns: boolean - true if it's a new record that's not an infrastructure type

ChatAlerts : object

Polls the system for Chat Messages

Kind: global namespace
Extends: AbstractAjaxProcessor

ChatAlerts.log()

Logs to the console if the DEBUG property is true

Kind: static method of ChatAlerts

ChatAlerts.getMyMessages() ⇒ HttpResponse

AJAX Function to get chat messages from the server and return them to the client

Kind: static method of ChatAlerts
Returns: HttpResponse - a response containing unacknowledge chat messages

ChatAlerts.acknowledgeMessage(sysparm_message_sys_id)

Acknowledges messages, so they will no longer appear on screen

Kind: static method of ChatAlerts

Param Type Description
sysparm_message_sys_id string The sys_id of a chat message

ChatAlerts._addChatMessage(gr)

Adds a chat message to the XML we are returning

Kind: static method of ChatAlerts

Param Type Description
gr GlideRecord A glide record of a chat message

ChatAlerts._dayOfWeek(i) ⇒ String

Helper function to get an abbreviation for the day of the week

Kind: static method of ChatAlerts
Returns: String - the three letter abbreviation for the day

Param Type Description
i Integer the numerical day of the week

ClassCreator : object

Kind: global namespace
Descriptioncreates: classes for Selenium automated browser testing

classCreator.initialize(camelCaseVariables, language, tableType)

Initializes values for the running of the script

Kind: instance method of ClassCreator

Param Type Description
camelCaseVariables string True for camelCase; false for non_camel_case
language string Which programming language
tableType string A table type (Task, CMDB) - Basically, any table that is extended

classCreator.getTaskTables()

Entry point for the class; creates records in the Class Generator table (or udpates them)

Kind: instance method of ClassCreator

classCreator.getCMDBTables()

Entry point for the class; creates records in the Class Generator table (or udpates them)

Kind: instance method of ClassCreator

classCreator.getTableVariables(tableName, cmdbFlag) ⇒ string

Starts a dictionary table query based on the table and its parent

Kind: instance method of ClassCreator
Returns: string - Data to insert into the table

Param Type Description
tableName string The table to query for
cmdbFlag boolean True if this is for cmdb (we want to ensure we get the base table, even if we're down a level or two of inheritance)

classCreator.generateClass(data, tablename) ⇒ string

Generates a class in the appropriate language

Kind: instance method of ClassCreator
Returns: string - Data to insert into the table

Param Type Description
data string A list of variables in a particular programming language
tablename string The table name of the class

classCreator.capitalizeFirstLetter(word) ⇒ string

Capitalizes the first letter of a word

Kind: instance method of ClassCreator
Returns: string - A word with the first word capitalized

Param Type Description
word string The word to capitalize

classCreator.replaceUnderscoresWithCamelCase(item) ⇒ string

Takes a word and makes it camelCase

Kind: instance method of ClassCreator
Returns: string - A camelCase version of the passed string

Param Type Description
item string The string to make camelCase

classCreator.getJavaVariables(gr, tableName) ⇒ string

Creates variables based on the Java programming language

Kind: instance method of ClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablenames

classCreator.getJavascriptVariables(gr, tableName) ⇒ string

Creates variables based on the Javascript programming language

Kind: instance method of ClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablenames

classCreator.getCSharpVariables(gr, tableName) ⇒ string

Creates variables based on the C# programming language

Kind: instance method of ClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablenames

classCreator.getPythonVariables(gr, tableName) ⇒ string

Creates variables based on the Python programming language

Kind: instance method of ClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablenames

classCreator.getRubyVariables(gr, tableName) ⇒ string

Creates variables based on the Ruby programming language

Kind: instance method of ClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablenames

InboundEmailTicketUtil : object

This is a class that contains all the utilities to handle Inbound Emails sent with the intent of creating new incident tickets.

Kind: global namespace
See: BlockCertainEmailsUtil

inboundEmailTicketUtil.initialize(emailThing)

Sets email object for entire class equal to the current email record that we'll be dealing with

Kind: instance method of InboundEmailTicketUtil

Param Type Description
emailThing GlideRecord An email record

inboundEmailTicketUtil.checkForUser(emailRec) ⇒ GlideRecord

Checks for whether or not there is a user in the system, based on the email provided

Kind: instance method of InboundEmailTicketUtil
Returns: GlideRecord - the user from the email

Param Type Description
emailRec string String containing the sender

inboundEmailTicketUtil.isNewTicket() ⇒ boolean

Checks all of the emails in the to,cc,and from fields. Finds if any of them have incidents that aren't resolved or closed with a short description that matches the subject of the email

Kind: instance method of InboundEmailTicketUtil
Returns: boolean - true if this is a new incident; false otherwise

inboundEmailTicketUtil.handleTicket(current)

Checks to see whether the person sending this email is from inside service-now or not. If that person is, found in our system, make an incident

Kind: instance method of InboundEmailTicketUtil

Param Type Description
current GlideRecord the current incident record

inboundEmailTicketUtil.createIncident(current)

Creates an incident based on the user and the contents of the email

Kind: instance method of InboundEmailTicketUtil

Param Type Description
current GlideRecord An incident Record

inboundEmailTicketUtil.handleWatchList() ⇒ string

Handles the addition of users to the watch list of an incident

Kind: instance method of InboundEmailTicketUtil
Returns: string - a list of users to add to the watch list

inboundEmailTicketUtil.handleNonFoundEmail()

Forwards the current email to the support desk. Text, attachments, and all.

Kind: instance method of InboundEmailTicketUtil

inboundEmailTicketUtil.handleWorkNotes(current)

Looks through every email in the To,CC, and From fields and finds whether or not there is an incident with a short description that matches the subject of this current email (minus the "Re: "). If one is found, add the contents of the this email to the worknotes

Kind: instance method of InboundEmailTicketUtil

Param Type Description
current GlideRecord the current incident

inboundEmailTicketUtil.addToIncident(inc)

Takes the incident record, and adds the contents of this email, including attachments, to it

Kind: instance method of InboundEmailTicketUtil

Param Type Description
inc GlideRecord the current incident

inboundEmailTicketUtil.decodeHtmlEntity(str)

Ensures that special characters don't show up as HTML encoded entities. Ex: &#8211 should show up as -- and not the encoded value

Kind: instance method of InboundEmailTicketUtil
Retun: string the string without HTML encoding

Param Type Description
str string A string to decode

ModelClassCreator : object

Creates Model Classes for RESTful services

Kind: global namespace

modelClassCreator.initialize(tableType)

Initializes values for the running of the script

Kind: instance method of ModelClassCreator

Param Type Description
tableType string A table type (Task, CMDB) - Basically, any table that is extended

modelClassCreator.getTaskTables()

Entry point for the class; creates records in the Class Generator Model table (or updates them)

Kind: instance method of ModelClassCreator

modelClassCreator.getTableVariables(tableName) ⇒ string

Starts a dictionary table query based on the table and its parent

Kind: instance method of ModelClassCreator
Returns: string - Data to insert into the table

Param Type Description
tableName string The table to query for

modelClassCreator.generateClass(data, tablename) ⇒ string

Generates a class in the appropriate language

Kind: instance method of ModelClassCreator
Returns: string - Data to insert into the table

Param Type Description
data string A list of variables in a particular programming language
tablename string The table name of the class

modelClassCreator.generateCollectionClass(tablename) ⇒ string

Generates a Collection class for handling the data

Kind: instance method of ModelClassCreator
Returns: string - Data to insert into the table

Param Type Description
tablename string The table name of the class

modelClassCreator.collectionClassBody(tablename) ⇒ string

Generates the body of the collection class

Kind: instance method of ModelClassCreator
Returns: string - Data to insert into the table

Param Type Description
tablename string The table name of the class

modelClassCreator.capitalizeFirstLetter(word) ⇒ string

Capitalizes the first letter of a word

Kind: instance method of ModelClassCreator
Returns: string - A word with the first word capitalized

Param Type Description
word string The word to capitalize

modelClassCreator.lowerCaseFirstLetter(word) ⇒ string

Makes the first letter of a word lowercase

Kind: instance method of ModelClassCreator
Returns: string - The word with the first letter capitalized

Param Type Description
word string The word to make lowercase on first character

modelClassCreator.replaceUnderscoresWithCamelCase(item) ⇒ string

Takes a word and makes it camelCase

Kind: instance method of ModelClassCreator
Returns: string - A camelCase version of the passed string

Param Type Description
item string The string to make camelCase

modelClassCreator.getJavaVariables(gr, tableName) ⇒ string

Creates variables based on the Java programming language

Kind: instance method of ModelClassCreator
Returns: string - A list of variables

Param Type Description
gr GlideRecord Record containing dictionary entries
tableName string The tablename

modelClassCreator.getFormalDataType(elementType) ⇒ string

gets the formal data type of an element

Kind: instance method of ModelClassCreator
Returns: string - boolean if a boolean; String if a string

Param Type Description
elementType string the defined element type in ServiceNow

modelClassCreator.getParentElementType(elementName) ⇒ String

Finds out what type of element we are dealing with

Kind: instance method of ModelClassCreator
Returns: String - what the scalar_type of the element (ie: base type) is

Param Type Description
elementName String the type of element

OnboardingUtil : object

Contains functions for onboarding

Kind: global namespace

onboardingUtil.isOnboarding() ⇒

Checks to see if the request is an Onboarding request or not

Kind: instance method of OnboardingUtil
Returns: true if this is for an onboarding request

onboardingUtil.isVendorAccessRequest() ⇒

Checks to see if the request is a Vendor Access Request or not

Kind: instance method of OnboardingUtil
Returns: true if this is a Vendor Access Request

onboardingUtil.getVendorRequestType() ⇒ string

If this is a Vendor Access Request, checks to see if it is a new or existing, because they use different variables for the name of the vendor

Kind: instance method of OnboardingUtil
Returns: string - 'new' if a new vendor and 'existing' if an existing vendor

ProposedChangeHandler : object

Provides functionality for discovering information about proposed changes, can handle multiple proposed changes per change request

Kind: global namespace

proposedChangeHandler.initialize()

Sets the arrays to empty so they can be used throughout the class

Kind: instance method of ProposedChangeHandler

proposedChangeHandler.presentData(current) ⇒ string

Main method, presents the data in a printable format for emails and such

Kind: instance method of ProposedChangeHandler
Returns: string - A printable list of data

Param Type Description
current GlideRecord The current record

Example

//Within an email or HTML field
template.print(new ProposedChangeHandler().presentData(current));

proposedChangeHandler.getDictionaryFields(tablename)

Gets all fields in the dictionary related to a set of tables

Kind: instance method of ProposedChangeHandler

Param Type Description
tablename string The base table name to query with

proposedChangeHandler.getFieldLabel(element, name) ⇒ string

Queries the field label table to find the label of the field for displaying later

Kind: instance method of ProposedChangeHandler
Returns: string - Either the label of the field, or just the element argument if no label was found

Param Type Description
element string The name of the field
name string The name of the table

proposedChangeHandler.getParentTable(tablename) ⇒ function

Gets the name of the super class of the current table, and pushes it to the parentArray

Kind: instance method of ProposedChangeHandler
Returns: function - Recursive, if there is a super class it tries to find the top level

Param Type Description
tablename string A name of a table

proposedChangeHandler.getFormalName(tableSys) ⇒ string

Finds the formal name (not label) of a table

Kind: instance method of ProposedChangeHandler
Returns: string - the display/formal name of the table

Param Type Description
tableSys string a sys id of a table

Example

getFormalName('d7d614a0790030001d9281cf14342734'); // 'alm_asset'
getFormalName(''); // ''

proposedChangeHandler.getRelevantCIDataFromAffectedCI(current)

Searches through Affected CI's for proposed changes

Kind: instance method of ProposedChangeHandler

Param Type Description
current GlideRecord the current Task record

proposedChangeHandler.handleXML(record) ⇒ array

Handles the processing of the payload in the proposed change

Kind: instance method of ProposedChangeHandler
Returns: array - An Array of objects

Param Type Description
record GlideRecord the TaskCI record

proposedChangeHandler.dealWithReferences(value, reference) ⇒ string

Since some values are references, we don't want to present sys_ids to the user, but actual readable values

Kind: instance method of ProposedChangeHandler
Returns: string - The "name" property of the table

Param Type Description
value string A record sys_id
reference string A table that is referenced

Example

dealWithReferences('6b39cf5b3d514d40536529c60b915ff6', 'sys_user'); // 'Justin Bauguess'

proposedChangeHandler.dealWithDropDown(value, fieldObject) ⇒ string

Gets the display value of a choice for dropdowns that have different label/value pairs

Kind: instance method of ProposedChangeHandler
Returns: string - the label that matches the value in the choice list

Param Type Description
value string The value of the choice
fieldObject object an object containing information about a field

Example

dealWithDropDown('1', fieldObject); // Assuming the fieldObject is for CMDB_CI.status, "Installed"

proposedChangeHandler.dealWithBlankChange(text) ⇒ string

Replaces an empty string with the word "Nothing"

Kind: instance method of ProposedChangeHandler
Returns: string - the string if it's not empty or "Nothing" if it is empty

Param Type Description
text string a string to test

Example

dealWithBlankChange('   '); // 'Nothing'
dealWithBlankChange('Something'); // 'Something'

proposedChangeHandler.autoApplyChange(current)

Applies the proposed changes automatically without the UI Action

Kind: instance method of ProposedChangeHandler

Param Type Description
current GlideRecord A change request record

Example

//Within a business rule with a condition of change_request.approval changesTo 'approved'
new ProposedChangeHandler().autoApplyChange(current);

ReworkCancellation : object

Handles the cancellation of reworked Requested Items

Kind: global namespace

reworkCancellation.checkForAutoReject()

Checks requested items in a state of rework that haven't been updated in a certain time period

Kind: instance method of ReworkCancellation
Example

//From within a Scheduled Job
new ReworkCancellation().checkForAutoReject();

reworkCancellation.autoReject(ritm) ⇒ integer

If a request has been idle for too long, it needs to be rejected and closed

Kind: instance method of ReworkCancellation
Returns: integer - The state of the requested item

Param Type Description
ritm GlideRecord A requested item

reworkCancellation.cancelWorkflowContexts(ritm)

Cancels all workflow contexts related to a ritm

Kind: instance method of ReworkCancellation

Param Type Description
ritm GlideRecord A requested item

ReworkUtil : object

Handles functionality for rework

Kind: global namespace

ReworkUtil.isReworkable(current) ⇒ boolean

Determines if a catalog item is reworkable

Kind: static method of ReworkUtil
Returns: boolean - true if the catalog item is reworkable; false otherwise

Param Type Description
current GlideRecord The current requested item record OR the sys_id

Example

//From an email notification, to include the rework link
var ru = new ReworkUtil();
ru.isReworkable(current);

ReworkUtil.checkApprover(current, name) ⇒ boolean

Checks to see if the approver is the same as the "requested for"

Kind: static method of ReworkUtil
Returns: boolean - false if the approver is the requested for, true otherwise

Param Type Description
current GlideRecord The current requested item record
name string The name of the requested for

ReworkUtil.getCatItem(ritm) ⇒ string

Gets the catalog item related to the ritm, if we only have a sys_id

Kind: static method of ReworkUtil
Returns: string - The sys_id of the catalog item

Param Type Description
ritm string The sys_id of a ritm

ReworkUtil.getRequestedForName(ritm) ⇒ string

Gets the requested for variable from the ritm

Kind: static method of ReworkUtil
Returns: string - The sys_id of the requested for variable

Param Type Description
ritm string The sys_id of a ritm

ScheduleNewHolidaysUtil : object

This contains the method needed to insert new or update holiday records

Kind: global namespace

SecurityAccessUtil : object

Handles checks for Security Access Requests

Kind: global namespace

securityAccessUtil.isSecurityAccessRequest() ⇒ boolean

Checks to see if the ritm is a Security Access Request

Kind: instance method of SecurityAccessUtil
Returns: boolean - true if it's a security access request; false otherwise

securityAccessUtil.getSecurityAccessType() ⇒ string

Gets the type of Security Access Request, so we can get the proper variables

Kind: instance method of SecurityAccessUtil
Returns: string - One of the request access types (new_access, edit_access, delete_access)

securityAccessUtil.getApproverByPhase(catItem, number) ⇒ string

Given a category item and a phase, returns the approver required

Kind: instance method of SecurityAccessUtil
Returns: string - sys_id of the approver

Param Type Description
catItem string The sys_id of a cat item
number integer Which approval to retrieve

securityAccessUtil.getPeopleSoftNonAppApprovers(ritm) ⇒ GlideRecord

Finds the approval records that are not the Hiring manager nor the normal application approvers

Kind: instance method of SecurityAccessUtil
Returns: GlideRecord - a ready-to-be-queried glide record that should contain any approvals that are idle

Param Type Description
ritm string Optional parameter to determine what requested item needs the approval checked

securityAccessUtil.expirePeopleSoftApprovals(approval)

Sets the approval to cancelled if it has sat idle for a certain period of time

Kind: instance method of SecurityAccessUtil

Param Type Description
approval GlideRecord The approval records to update

securityAccessUtil.getApplicationApprovers(application) ⇒ array

Queries the application approvers table for the sys_ids of the approvers for a given application access request

Kind: instance method of SecurityAccessUtil
Returns: array - An array containing the sys_ids of all approvers

Param Type Description
application string The name of an application access request

ServiceAccount : object

Allows for the creation of users that are useful for service accounts, so they can access web services from ServiceNow

Kind: global namespace

serviceAccount.createAccount(group, product) ⇒ string

creates the account - main method

Kind: instance method of ServiceAccount
Returns: string - The account name of the created account

Param Type Description
group string The sys_id of a group record
product string The sys_id of a application_software record

serviceAccount._createAccount() ⇒ string

does the creation of the account once the values are set

Kind: instance method of ServiceAccount
Returns: string - the user name of the newly created account

serviceAccount._sanitizeName(name) ⇒ string

replaces non word and whitespace, makes the string lowercase

Kind: instance method of ServiceAccount
Returns: string - the name without spaces, non-word characters, and in lowercase

Param Type Description
name string The name to sanitize

serviceAccount._assignGroupMembership(the)

Assigns the newly created user to the group who requested it

Kind: instance method of ServiceAccount

Param Type Description
the string sys_id of a user

serviceAccount._assignSOAPQueryRole(user)

Assigns the soap query role to the service account so it has read access

Kind: instance method of ServiceAccount

Param Type Description
user string The sys_id of the user to add soap_query to

serviceAccount._getGroupInfo(group) ⇒ string

Gets the name of the group

Kind: instance method of ServiceAccount
Returns: string - The name of the group

Param Type Description
group string The sys_id of a group

serviceAccount._getProductInfo(group) ⇒ string

Gets the name of the application

Kind: instance method of ServiceAccount
Returns: string - The name of the application

Param Type Description
group string The sys_id of an application

serviceAccount._checkDuplicates(name) ⇒ number

Ensures there is not already a service account for the group/application

Kind: instance method of ServiceAccount
Returns: number - how many accounts are associated with the group/application

Param Type Description
name string The name of a user

ServiceCatalogUtils : object

Utilities for general Service Catalog items: requests, requested items, etc.

Kind: global namespace
Extends: AbstractAjaxProcessor

ServiceCatalogUtils.getContractorEndDate(sysparm_contractor) ⇒ Date

Determines the current end date of a contractor

Kind: static method of ServiceCatalogUtils
Returns: Date - the contractor's current expiration date OR the current date if the contractor's date is empty

Param Type Description
sysparm_contractor string AJAX parameter that contains a contractor's sys_id

ServiceCatalogUtils.isContractorEndDate(sysparm_contractor) ⇒ boolean

Returns the expiration date of the current user

Kind: static method of ServiceCatalogUtils
Returns: boolean - true if the contractor has an end date; false otherwise

Param Type Description
sysparm_contractor string AJAX parameter that contains a contractor's sys_id

ServiceCatalogUtils.getContractorCompany(sysparm_contractor) ⇒ string

Determines the company of the current contractor

Kind: static method of ServiceCatalogUtils
Returns: string - the current company of the contractor

Param Type Description
sysparm_contractor string AJAX parameter that contains a contractor's sys_id

ServiceCatalogUtils.areApprovalsComplete(sysparm_task) ⇒ boolean

Iterate through all approvals related to a task.

Kind: static method of ServiceCatalogUtils
Returns: boolean - If any are still 'requested', return false.

Param Type Description
sysparm_task string AJAX parameter which is the current task number

ServiceCatalogUtils.areTasksComplete(sysparm_task) ⇒ boolean

Iterate through all approvals related to a task.

Kind: static method of ServiceCatalogUtils
Returns: boolean - If any are not in a 'Complete' state, return false;

Param Type Description
sysparm_task string AJAX parameter which is the current task number

ServiceCatalogUtils.canStateBeChanged(sysparm_task, sysparm_req) ⇒ boolean

Checks approvals and tasks for completion.

Kind: static method of ServiceCatalogUtils
Returns: boolean - If complete, returns true.

Param Type Description
sysparm_task string AJAX parameter of the current task number
sysparm_req string AJAX parameter of the current request number

ServiceCatalogUtils.firewallRuleRef() ⇒ string

the reference qualifier for the CI field on the Firewall Rule Request form

Kind: static method of ServiceCatalogUtils
Returns: string - a string containing the appropriate reference qualifier
Example

//From a Reference Qual field on a dictionary entry or variable entry
javascript:new ServiceCatalogUtils().firewallRuleRef();

ServiceCatalogUtils.updateReferenceQual(sysparm_category, sysparm_app) ⇒ string

Used by the Request Addition to the CMDB

Kind: static method of ServiceCatalogUtils
Returns: string - a toStringed array of subcategory values

Param Type Description
sysparm_category string AJAX parameter The name of a category
sysparm_app string AJAX parameter The name of an application

updateReferenceQual~app

Since changing the category value clears the subcategory, we must provide existing subcategory if present

Kind: inner property of updateReferenceQual

ServiceCatalogUtils.getUserInformationOnRITM()

Since the g_form.getReference method is weird on RITMs, use this to get user information

Kind: static method of ServiceCatalogUtils

ServiceCatalogUtils.isAutomated(name) ⇒ boolean

Determines if the work done for a catalog item request is automated with code or not

Kind: static method of ServiceCatalogUtils
Returns: boolean - true if the work is automated; false if there are tasks to be generated

Param Type Description
name string the name of a requested item's catalog item

ServiceCatalogUtils.isAdSales(title) ⇒ boolean

Checks to see if the ritm is an Ad Sales Request

Kind: static method of ServiceCatalogUtils
Returns: boolean - true if it's an ad sales request

Param Type Description
title string The title of a ritm's catalog item title

ServiceCatalogUtils.getAdSalesType(approvalFor) ⇒ string

Determines the type of Ad Sales request

Kind: static method of ServiceCatalogUtils
Returns: string - On-Air or Digital

Param Type Description
approvalFor GlideRecord a requested item record

ServiceCatalogUtils.isFirewall(name) ⇒ boolean

Checks to see if the ritm is a Firewall Rule Request

Kind: static method of ServiceCatalogUtils
Returns: boolean - true if it's a firewall rule request

Param Type Description
name string the name of a requested item's catalog item

ServiceCatalogUtils.waitForTasksComplete(current) ⇒ boolean

Checks tasks for the current requested item for completion

Kind: static method of ServiceCatalogUtils
Returns: boolean - true if all tasks are complete; false otherwise

Param Type Description
current GlideRecord A requested item

Example

//From a Wait For Condition in a workflow
answer = new ServiceCatalogUtils().waitForTasksComplete(current);

SNFormatter : object

Contains functions to format values properly, such as money, strings, titles, etc.

Kind: global namespace

snFormatter.formatMoneyValue(value) ⇒ string

Formats a string into a money value; does not check to see if it's just numbers

Kind: instance method of SNFormatter
Returns: string - a string formatted with a dollar sign and at least 2 decimal places

Param Type Description
value string the value to convert to money

Example

SNFormatter.formatMoneyValue('12.333'); // $12.33

Example

SNFormatter.formatMoneyValue('12.3'); // $12.33

SNUnit : object

Runs back-end unit tests in ServiceNow

Kind: global namespace

snUnit.initialize(setup, teardown)

creates the test object

Kind: instance method of SNUnit

Param Type Description
setup function A setup function
teardown function A teardown function

snUnit.setSetup(setup)

set a setup function

Kind: instance method of SNUnit

Param Type Description
setup function A setup function

snUnit.setTeardown(teardown)

set a teardown function

Kind: instance method of SNUnit

Param Type Description
teardown function A teardown function

snUnit.test(name, callback)

Runs a test, first calling the setup and finally calling the teardown

Kind: instance method of SNUnit

Param Type Description
name string A description of the test
callback function A function containing tests

SNValidator : object

Validates arguments for ServiceNow classes

Kind: global namespace

snValidator.checkValidStringArgument(string) ⇒ boolean

Validates that an argument is, in fact, a string

Kind: instance method of SNValidator
Returns: boolean - true if an object

Param Type Description
string string A string to test

Example

SNValidator.checkValidStringArgument('Words'); //true

Example

SNValidator.checkValidStringArgument(1000); //false

Example

SNValidator.checkValidStringArgument(['words']); //false

snValidator.checkValidObjectArgument(object) ⇒ Boolean

Validates that an argument is, in fact, an object

Kind: instance method of SNValidator
Returns: Boolean - true if an object

Param Type Description
object Object An object to test

Example

var obj = {};
SNValidator().checkValidObjectArgument(obj); //true

Example

var obj = 'Test';
SNValidator().checkValidObjectArgument(obj); //false

snValidator.checkValidNumberArgumentLoose(number) ⇒ boolean

Validates than an argument is, in fact, a valid number, but uses == instead of ===

Kind: instance method of SNValidator
Returns: boolean - true if the value is a number

Param Type Description
number number A number to test

Example

SNValidator().checkValidNumberArgumentLoose(1000); //true

Example

SNValidator().checkValidNumberArgumentLoose('1000'); //true

Example

SNValidator().checkValidNumberArgumentLoose('1000a'); //false

snValidator.checkValidNumberArgumentStrict(number) ⇒ boolean

Validates than an argument is, in fact, a valid number, uses ===

Kind: instance method of SNValidator
Returns: boolean - true if the value is a number

Param Type Description
number number A number to test

Example

SNValidator().checkValidNumberArgumentStrict(1000); //true

Example

SNValidator().checkValidNumberArgumentStrict('1000'); //false

snValidator.checkValidSysIDArgument(sys_id) ⇒ Boolean

Validates that an argument is, in fact, a sys_id

Kind: instance method of SNValidator
Returns: Boolean - true if a sys_id

Param Type Description
sys_id string A string to test

Example

SNValidator.checkValidSysIDArgument('153ebc53a4377100764f456eb40d41f1'); //true

Example

SNValidator.checkValidSysIDArgument('ZXYWbxjf1243892389'); //false

snValidator.checkValidCallbackArgument(callback) ⇒ boolean

Validates that an argument is, in fact, a function to callback

Kind: instance method of SNValidator
Returns: boolean - true if a valid function (or object)

Param Type Description
callback function A function to test

Example

var func = function() { console.log("boom"); };
SNValidator.checkValidCallbackArgument(func); //true

Example

var func = {};
SNValidator.checkValidCallbackArgument(func); //false

snValidator.logger() ⇒ boolean

Logger function that does not work in prod (scripps)

Kind: instance method of SNValidator
Returns: boolean - true if the instance is not production; false otherwise

SNVariableUtil : object

Contains functionality that handles service catalog variables or other dictionary items

Kind: global namespace

snVariableUtil.dealWithListTable(list, table) ⇒ string

Handles list collectors

Kind: instance method of SNVariableUtil
Returns: string - a string of actual values

Param Type Description
list string a list of values/sys_ids
table string the name of a table

snVariableUtil.getReferenceDisplayVariableName(table) ⇒ string

Finds the dictionary entry for a table that is the display value

Kind: instance method of SNVariableUtil
Returns: string - the name of the column (element) which is the display value

Param Type Description
table string a table name

snVariableUtil.dealWithReference(reference, value) ⇒ string

Reference fields need to be retrieved before giving a proper value

Kind: instance method of SNVariableUtil
Returns: string - the value we care about in the table (number for tasks, name for others)

Param Type Description
reference string the name of a table which is being referenced
value string the sys_id value of what is being referenced

snVariableUtil.isTextField(fieldType) ⇒ boolean

Determines if the field type is a text type (Single, Wide or Multiline)

Kind: instance method of SNVariableUtil
Returns: boolean - true if it's a text field; otherwise, false

Param Type Description
fieldType number a number which represents a field type in the system

snVariableUtil.getSelectValueBasedOnValue(name, value) ⇒ string

Finds the value that appears on the form for a Select Box

Kind: instance method of SNVariableUtil
Returns: string - the text value of the question choice

Param Type Description
name string the name of the question/select box variable
value string the value of the question choice

snVariableUtil.isFinancial(A) ⇒ boolean

Checks to see if the variable is a financial email, so we can format it properly

Kind: instance method of SNVariableUtil
Returns: boolean - true if the variable is a financial variable; false otherwise

Param Type Description
A variable catalog variable

UserAndGroupUtils : object

Utility functions for users and groups

Kind: global namespace

userAndGroupUtils.exectueInactiveCleanup()

Main Method for cleaning up users and groups (Platform 3.1)

Kind: instance method of UserAndGroupUtils

userAndGroupUtils.toggleBusinessRules(status)

Changes the status on business rules for the sys_user_grmember table

Kind: instance method of UserAndGroupUtils

Param Type Description
status boolean true or false value to apply to the active field on the record

userAndGroupUtils.deleteInactiveGroupMembers()

Deletes any group membership record where the user is no longer active

Kind: instance method of UserAndGroupUtils

userAndGroupUtils.deleteInactiveRoleAssignments()

Deletes any role assignment record where the user is no longer active

Kind: instance method of UserAndGroupUtils

userAndGroupUtils.isUserInGroup(user, group) ⇒ boolean

Given a user's sys_d and a group name, determines if a user is in a group

Kind: instance method of UserAndGroupUtils
Returns: boolean - true if the user is a member of the group; false otherwise

Param Type Description
user string a sys_id of a user
group string a name of a group

VariableClearer : object

There are times when variables on a ritm need to be cleared due to users changing options without clearing them. Using g_form.setValue('name', '') will not work on the client side because the form needs the sys_id (with ni.VE prepended) to identify the element on the form

Kind: global namespace
Extends: AbstractAjaxProcessor

VariableClearer.findNonApplicableVariables(variableMap, recordSysId)

Given a map of variables that are related and a ritm, finds the sys_id of the variables on the form so they can be cleared properly

Kind: static method of VariableClearer

Param Type Description
variableMap object An object containing a variable name and it'd dependent values
recordSysId string The sys_id of a requested item

VariableClearer.clearNonApplicableVariables(clearList, recordSysId) ⇒ string

Given a list of variable names and requested item, finds the sys_id of those variables so they can be cleared properly

Kind: static method of VariableClearer
Returns: string - A string of variable sys_ids to clear

Param Type Description
clearList array An array of variable names
recordSysId string The sys_id of a requested item

VariableClearer.handlePeopleSoft(record)

Ensures that variables that should be empty are before saving the record

Kind: static method of VariableClearer

Param Type Description
record GlideRecord The current requested item