- 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
object
Handles functionality for the AccessRequestApproverUpdate catalog item
Kind: global namespace
Extends: AbstractAjaxProcessor
See: SNValidator
- AccessRequestApproverUpdate :
object- .getApprovers() ⇒
string - .getAllowedGroups() ⇒
Array - .accessAllowed() ⇒
- .updateApprovers(current) ⇒
- .isCatalogItemSOX(current) ⇒
boolean - .cleanName(name) ⇒
string
- .getApprovers() ⇒
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 |
returns an array groups who are allowed to view the catalog item
Kind: static method of AccessRequestApproverUpdate
Returns: Array - A list of group names
Determines if a user can access the catalog item
Kind: static method of AccessRequestApproverUpdate
Returns: - true if the user can access it
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 |
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 |
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 |
Application Access request utilities
Kind: global namespace
- ApplicationAccessRequestUtils :
object
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 |
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 |
Gets the Hiring Manager on the RITM
Kind: instance method of ApplicationAccessRequestUtils
| Param | Type | Description |
|---|---|---|
| gr | GlideRecord |
The sc_req_item glide record |
Gets the "Requested For" on the RITM
Kind: instance method of ApplicationAccessRequestUtils
| Param | Type | Description |
|---|---|---|
| gr | GlideRecord |
The sc_req_item glide record |
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
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
Retrieves approvals based on the ci
Kind: global namespace
- ApprovalRetriever :
object
Sets some class variables
Kind: instance method of ApprovalRetriever
| Param | Type | Description |
|---|---|---|
| current | GlideRecord |
the current record (typically a change request) |
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 |
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 |
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();
}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');Completely removes an approval record
Kind: instance method of ApprovalRetriever
Example
var ar = new ApprovalRetriever(current);
ar.removeNonCIApprovers();Removes and resets approvals on infrastructure
Kind: instance method of ApprovalRetriever
Example
var ar = new ApprovalRetriever(current);
else {
ar.removeInfrastructureApprovers();
}Removes and resets Emergency approvals
Kind: instance method of ApprovalRetriever
Example
var ar = new ApprovalRetriever(current);
if (current.type == "Emergency") {
ar.removeEmergencyApprovers();
}Resets approvals related to proposed changes
Kind: instance method of ApprovalRetriever
Example
var ar = new ApprovalRetriever(current);
if (NonAppliedProposedChangesExist(current)) {
ar.resetProposedChangeApprovers();
}Generates custom email text for approval or requested item emails
Kind: global namespace
Extends: SNVariableUtil
See
- SNValidator
- SNFormatter
- OnboardingUtil
- SercurityAccessUtil
- ServiceCatalogUtils
- ApprovalUtil :
object- .initialize()
- .getCustomFields() ⇒
string - .determineVariables()
- .handleNeededVariables(sc)
- .handleReturn() ⇒
string - .reorderResult() ⇒
string - .getVariables(argument) ⇒
array - .isReworkable() ⇒
boolean
Creates an ApprovalUtil object
Kind: static method of ApprovalUtil
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());Sets the variables list for the class
Kind: static method of ApprovalUtil
process
Kind: static method of ApprovalUtil
| Param | Type | Description |
|---|---|---|
| sc | GlideRecord |
The Catalog Variable Glide Record |
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
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
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 |
Determines if a catalog item is reworkable
Kind: static method of ApprovalUtil
Returns: boolean - true if the catalog item is reworkable; false otherwise
Populates the services and watch list based on the business application field on the incident form
Kind: global namespace
Extends: AbstractAjaxProcessor
- AppsAndServices :
object- .getService(sysparm_app, sysparm_ci) ⇒
string - .getApplication(sysparm_service) ⇒
string - .watchLister(sysparm_app) ⇒
string - .ciPopulator(sysparm_app, sysparm_ci, sysparm_service) ⇒
string - .ciRemover(sysparm_oldci) ⇒
string - .ciRemoverService(sysparm_oldci) ⇒
string
- .getService(sysparm_app, sysparm_ci) ⇒
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 |
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 |
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 |
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 |
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 |
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 |
Handles app/service relationships for the incident form
Kind: global namespace
See: ArrayUtil
- AppServiceUtil :
object
Ensures there's an instance of ArrayUtil available
Kind: instance method of AppServiceUtil
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 |
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 |
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 |
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 |
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 |
Contains assertions for running unit tests
Kind: global namespace
- Assertions :
object- .results :
Object - .initialize(tableName, functionName, testName)
- .setFunctionName(functionName)
- .setTableName(tableName)
- .setTestName(testName)
- .assertEqual(expected, actual, message)
- .assertDeepEqual(expected, actual, message)
- .assertNotEqual(expected, actual, message)
- .assertDeepNotEqual(expected, actual, message)
- .assertThrows(block, message)
- .assertTrue(value, message)
- .assertFalse(value, message)
- .pass(message)
- .fail(message)
- .cleanUpMessage(message) ⇒
string - .createResultRecord(message, flag)
- .results :
An object containing an array of results
Kind: instance property of Assertions
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 |
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 |
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 |
sets the name of the test
Kind: instance method of Assertions
| Param | Type | Description |
|---|---|---|
| testName | string |
The name of the test |
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'); //falseassertDeepEqual 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?'); //trueAsserts 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?'); //falseAsserts 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?'); //falseAsserts 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"'); //trueAsserts 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?'); //falseAsserts 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?'); //trueHandles the passing of a test
Kind: instance method of Assertions
| Param | Type | Description |
|---|---|---|
| message | string |
A message describing the test |
Handles the failure of a test
Kind: instance method of Assertions
| Param | Type | Description |
|---|---|---|
| message | string |
A message describing the test |
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 |
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 |
Checks the current record for attachments
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 |
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 :
object- .checkBlockedEmail(emailName) ⇒
boolean - .trimOutFrom(header) ⇒
string
- .checkBlockedEmail(emailName) ⇒
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 |
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 |
Creates classes for Selenium automated browser testing
Kind: global namespace
- CatalogClassCreator :
object- .initialize(camelCaseVariables, language)
- .processServiceCatalog()
- .getServiceCatalogVariables(catalogItem) ⇒
string - .generateClass(data, itemName) ⇒
string - .capitalizeFirstLetter(word) ⇒
string - .replaceUnderscoresWithCamelCase(item) ⇒
string - .replaceSpaces(item) ⇒
string - .getVariableSets(catalogItem) ⇒
array - .getJavaVariables(gr) ⇒
array - .getJavascriptVariables(gr) ⇒
array - .getCSharpVariables(gr) ⇒
array - .getPythonVariables(gr) ⇒
array - .getRubyVariables(gr) ⇒
array
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 |
The entry point to the script
Kind: instance method of CatalogClassCreator
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 |
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 |
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 |
- 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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Sets the CI reference qualifier for the Change Request Table based on the type of change request
Useful for server side CM functionality
Kind: global namespace
Extends: AbstractAjaxProcesseor
- ChangeManagementUtil :
object- .isEmergencyPreApprovalComplete()
- .eliminateWorkflow(current)
- .isUserInGroup(sysparm_user) ⇒
boolean - .isServerBuild(type) ⇒
boolean - .wereWorkNotesDone(sysparm_task) ⇒
boolean - .checkApprovalCountInWorkflowStageOne(current, comparison) ⇒
string - .checkApprovalCountInWorkflowStageTwo(current, comparison) ⇒
string - .checkCMPhaseApproval(current, changeApproversTotal-) ⇒
string - .checkApprovalCountInWorkflow(current) ⇒
string - .checkPhaseTwoApproval(current, changeApproversTotal-) ⇒
string - .isCM(approver) ⇒
boolean - .seeIfRegularApproverIsRemoved(approvalGR, comparison) ⇒
boolean - .isPredefined(current) ⇒
boolean - .reschedule(current) ⇒
GlideRecord - .copyChangeTasks(current, childChange)
- .copyAffectedCIs(current, the)
- .copyImpactedServices(current, the)
- .checkForAllChangeTasksClosed(changeRequestSysID)
- .updateChangeTasksClosedField(changeRequestSysID, action)
Checks to see if the emergency pre approval is complete, so we don't show an unnecessary message
Kind: static method of ChangeManagementUtil
Deletes the current workflow
Kind: static method of ChangeManagementUtil
| Param | Type | Description |
|---|---|---|
| current | GlideRecord |
The current change request |
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 |
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 |
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 |
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 |
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 |
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 |
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) |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
A class for handling change tasks
Kind: global namespace
- ChangeTasker :
object- .initialize(change)
- .runOnScheduled()
- .runOnNewChange()
- .runOnTypeChange()
- .runOnUpdate()
- ._getBaseTasks() ⇒
array - ._getSoxTasks() ⇒
array - .getCurrentTasks() ⇒
GlideRecord - ._deleteOldTasks()
- ._createNewTasks()
- ._shouldSOXTasksBeMade() ⇒
boolean - .resetEmergencyApprovalTask()
- .isEmergencyGoingBack() ⇒
boolean - .isInfrastructureScheduled() ⇒
boolean - .isNonInfrastructureCreated() ⇒
boolean
initializes values for the class
Kind: instance method of ChangeTasker
| Param | Type | Description |
|---|---|---|
| change | GlideRecord |
Change Request |
Main Method for when a change request moves into "Scheduled" LCS
Kind: instance method of ChangeTasker
Main Method for New Changes
Kind: instance method of ChangeTasker
Runs if the type of a change request is changed
Kind: instance method of ChangeTasker
Compares current change tasks with a list of sox change tasks to see if any need to be generated
Kind: instance method of ChangeTasker
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
runs to deal with SOX related change requests
Kind: instance method of ChangeTasker
Returns: array - an array of tasks data
Gets a list of change tasks given a change request
Kind: instance method of ChangeTasker
Returns: GlideRecord - the change tasks related to a change
Deletes all change tasks related to the current change request, but only if they are inactive
Kind: instance method of ChangeTasker
Creates new tasks for a change request
Kind: instance method of ChangeTasker
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
Resets the emergency approval task to open
Kind: instance method of ChangeTasker
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
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
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
Polls the system for Chat Messages
Kind: global namespace
Extends: AbstractAjaxProcessor
- ChatAlerts :
object- .log()
- .getMyMessages() ⇒
HttpResponse - .acknowledgeMessage(sysparm_message_sys_id)
- ._addChatMessage(gr)
- ._dayOfWeek(i) ⇒
String
Logs to the console if the DEBUG property is true
Kind: static method of ChatAlerts
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
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 |
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 |
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 |
Kind: global namespace
Descriptioncreates: classes for Selenium automated browser testing
- ClassCreator :
object- .initialize(camelCaseVariables, language, tableType)
- .getTaskTables()
- .getCMDBTables()
- .getTableVariables(tableName, cmdbFlag) ⇒
string - .generateClass(data, tablename) ⇒
string - .capitalizeFirstLetter(word) ⇒
string - .replaceUnderscoresWithCamelCase(item) ⇒
string - .getJavaVariables(gr, tableName) ⇒
string - .getJavascriptVariables(gr, tableName) ⇒
string - .getCSharpVariables(gr, tableName) ⇒
string - .getPythonVariables(gr, tableName) ⇒
string - .getRubyVariables(gr, tableName) ⇒
string
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 |
Entry point for the class; creates records in the Class Generator table (or udpates them)
Kind: instance method of ClassCreator
Entry point for the class; creates records in the Class Generator table (or udpates them)
Kind: instance method of ClassCreator
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) |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 :
object
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 |
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 |
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
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 |
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 |
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
Forwards the current email to the support desk. Text, attachments, and all.
Kind: instance method of InboundEmailTicketUtil
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 |
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 |
Ensures that special characters don't show up as HTML encoded entities. Ex: – 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 |
Creates Model Classes for RESTful services
Kind: global namespace
- ModelClassCreator :
object- .initialize(tableType)
- .getTaskTables()
- .getTableVariables(tableName) ⇒
string - .generateClass(data, tablename) ⇒
string - .generateCollectionClass(tablename) ⇒
string - .collectionClassBody(tablename) ⇒
string - .capitalizeFirstLetter(word) ⇒
string - .lowerCaseFirstLetter(word) ⇒
string - .replaceUnderscoresWithCamelCase(item) ⇒
string - .getJavaVariables(gr, tableName) ⇒
string - .getFormalDataType(elementType) ⇒
string - .getParentElementType(elementName) ⇒
String
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 |
Entry point for the class; creates records in the Class Generator Model table (or updates them)
Kind: instance method of ModelClassCreator
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Contains functions for onboarding
Kind: global namespace
- OnboardingUtil :
object
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
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
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
Provides functionality for discovering information about proposed changes, can handle multiple proposed changes per change request
Kind: global namespace
- ProposedChangeHandler :
object- .initialize()
- .presentData(current) ⇒
string - .getDictionaryFields(tablename)
- .getFieldLabel(element, name) ⇒
string - .getParentTable(tablename) ⇒
function - .getFormalName(tableSys) ⇒
string - .getRelevantCIDataFromAffectedCI(current)
- .handleXML(record) ⇒
array - .dealWithReferences(value, reference) ⇒
string - .dealWithDropDown(value, fieldObject) ⇒
string - .dealWithBlankChange(text) ⇒
string - .autoApplyChange(current)
Sets the arrays to empty so they can be used throughout the class
Kind: instance method of ProposedChangeHandler
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));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 |
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 |
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 |
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(''); // ''Searches through Affected CI's for proposed changes
Kind: instance method of ProposedChangeHandler
| Param | Type | Description |
|---|---|---|
| current | GlideRecord |
the current Task record |
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 |
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'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"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'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);Handles the cancellation of reworked Requested Items
Kind: global namespace
- ReworkCancellation :
object
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();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 |
Cancels all workflow contexts related to a ritm
Kind: instance method of ReworkCancellation
| Param | Type | Description |
|---|---|---|
| ritm | GlideRecord |
A requested item |
Handles functionality for rework
Kind: global namespace
- ReworkUtil :
object- .isReworkable(current) ⇒
boolean - .checkApprover(current, name) ⇒
boolean - .getCatItem(ritm) ⇒
string - .getRequestedForName(ritm) ⇒
string
- .isReworkable(current) ⇒
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);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 |
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 |
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 |
This contains the method needed to insert new or update holiday records
Handles checks for Security Access Requests
Kind: global namespace
- SecurityAccessUtil :
object- .isSecurityAccessRequest() ⇒
boolean - .getSecurityAccessType() ⇒
string - .getApproverByPhase(catItem, number) ⇒
string - .getPeopleSoftNonAppApprovers(ritm) ⇒
GlideRecord - .expirePeopleSoftApprovals(approval)
- .getApplicationApprovers(application) ⇒
array
- .isSecurityAccessRequest() ⇒
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
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)
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 |
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 |
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 |
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 |
Allows for the creation of users that are useful for service accounts, so they can access web services from ServiceNow
Kind: global namespace
- ServiceAccount :
object- .createAccount(group, product) ⇒
string - ._createAccount() ⇒
string - ._sanitizeName(name) ⇒
string - ._assignGroupMembership(the)
- ._assignSOAPQueryRole(user)
- ._getGroupInfo(group) ⇒
string - ._getProductInfo(group) ⇒
string - ._checkDuplicates(name) ⇒
number
- .createAccount(group, product) ⇒
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 |
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
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 |
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 |
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 |
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 |
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 |
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 |
Utilities for general Service Catalog items: requests, requested items, etc.
Kind: global namespace
Extends: AbstractAjaxProcessor
- ServiceCatalogUtils :
object- .getContractorEndDate(sysparm_contractor) ⇒
Date - .isContractorEndDate(sysparm_contractor) ⇒
boolean - .getContractorCompany(sysparm_contractor) ⇒
string - .areApprovalsComplete(sysparm_task) ⇒
boolean - .areTasksComplete(sysparm_task) ⇒
boolean - .canStateBeChanged(sysparm_task, sysparm_req) ⇒
boolean - .firewallRuleRef() ⇒
string - .updateReferenceQual(sysparm_category, sysparm_app) ⇒
string - .getUserInformationOnRITM()
- .isAutomated(name) ⇒
boolean - .isAdSales(title) ⇒
boolean - .getAdSalesType(approvalFor) ⇒
string - .isFirewall(name) ⇒
boolean - .waitForTasksComplete(current) ⇒
boolean
- .getContractorEndDate(sysparm_contractor) ⇒
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 |
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 |
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 |
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 |
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 |
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 |
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();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 |
Since changing the category value clears the subcategory, we must provide existing subcategory if present
Kind: inner property of updateReferenceQual
Since the g_form.getReference method is weird on RITMs, use this to get user information
Kind: static method of ServiceCatalogUtils
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 |
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 |
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 |
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 |
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);Contains functions to format values properly, such as money, strings, titles, etc.
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.33Example
SNFormatter.formatMoneyValue('12.3'); // $12.33Runs back-end unit tests in ServiceNow
Kind: global namespace
- SNUnit :
object
creates the test object
Kind: instance method of SNUnit
| Param | Type | Description |
|---|---|---|
| setup | function |
A setup function |
| teardown | function |
A teardown function |
set a setup function
Kind: instance method of SNUnit
| Param | Type | Description |
|---|---|---|
| setup | function |
A setup function |
set a teardown function
Kind: instance method of SNUnit
| Param | Type | Description |
|---|---|---|
| teardown | function |
A teardown function |
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 |
Validates arguments for ServiceNow classes
Kind: global namespace
- SNValidator :
object- .checkValidStringArgument(string) ⇒
boolean - .checkValidObjectArgument(object) ⇒
Boolean - .checkValidNumberArgumentLoose(number) ⇒
boolean - .checkValidNumberArgumentStrict(number) ⇒
boolean - .checkValidSysIDArgument(sys_id) ⇒
Boolean - .checkValidCallbackArgument(callback) ⇒
boolean - .logger() ⇒
boolean
- .checkValidStringArgument(string) ⇒
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'); //trueExample
SNValidator.checkValidStringArgument(1000); //falseExample
SNValidator.checkValidStringArgument(['words']); //falseValidates 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); //trueExample
var obj = 'Test';
SNValidator().checkValidObjectArgument(obj); //falseValidates 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); //trueExample
SNValidator().checkValidNumberArgumentLoose('1000'); //trueExample
SNValidator().checkValidNumberArgumentLoose('1000a'); //falseValidates 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); //trueExample
SNValidator().checkValidNumberArgumentStrict('1000'); //falseValidates 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'); //trueExample
SNValidator.checkValidSysIDArgument('ZXYWbxjf1243892389'); //falseValidates 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); //trueExample
var func = {};
SNValidator.checkValidCallbackArgument(func); //falseLogger function that does not work in prod (scripps)
Kind: instance method of SNValidator
Returns: boolean - true if the instance is not production; false otherwise
Contains functionality that handles service catalog variables or other dictionary items
Kind: global namespace
- SNVariableUtil :
object- .dealWithListTable(list, table) ⇒
string - .getReferenceDisplayVariableName(table) ⇒
string - .dealWithReference(reference, value) ⇒
string - .isTextField(fieldType) ⇒
boolean - .getSelectValueBasedOnValue(name, value) ⇒
string - .isFinancial(A) ⇒
boolean
- .dealWithListTable(list, table) ⇒
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 |
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 |
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 |
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 |
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 |
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 |
Utility functions for users and groups
Kind: global namespace
- UserAndGroupUtils :
object
Main Method for cleaning up users and groups (Platform 3.1)
Kind: instance method of UserAndGroupUtils
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 |
Deletes any group membership record where the user is no longer active
Kind: instance method of UserAndGroupUtils
Deletes any role assignment record where the user is no longer active
Kind: instance method of UserAndGroupUtils
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 |
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 :
object
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 |
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 |
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 |