Back to Top

ServiceNow++ master

specialCases()

Special cases. Will be highlighted in yellow.

Returns

Void

main()

The main function. Colorizes rows, shortens descriptions, and adds buttons.

Returns

Void

appendEmailBtn(row, column)

Appends a copy email button that runs copyEmailToClipboard when clicked.

Parameters

Name Type Description
row HTMLElement
  • The HTML row element found in ServiceNow
column number
  • The column number where descriptions are located. Defaults to 3.

Returns

Void

appendTaskBtn(row, column)

Appends a copy task button that copies task number

Parameters

Name Type Description
row HTMLElement
  • The HTML row element found in ServiceNow
column number
  • The column number where task numbers are located. Defaults to 2.

Returns

Void

appendNameBtn(row, column)

Appends a copy name button that copies the first and last name in order without the comma

Parameters

Name Type Description
row HTMLElement
  • The HTML row element found in ServiceNow
column number
  • The column number where "Opened By" names are located. Defaults to 11.

Returns

Void

setColor(row)

Sets the color of the row based on the 12th child. When the 12th child contains my name "Cardosi, Alexander", the color will be marked green. Marks special cases yellow

Parameters

Name Type Description
row HTMLElement
  • The HTML row element

Returns

Void

getDescriptions(rows)

Returns descriptions from a nodelist of rows

Parameters

Name Type Description
rows nodelist
  • Nodelist of rows where the 3rd element is the description

Returns

string Array

Array of strings containing descriptions

getDescription(row)

Returns the description from a row

Parameters

Name Type Description
row HTMLElement
  • HTML row element

Returns

string

string containing descriptions

setDescriptions(descriptions, rows)

Sets each description in the array to their respective columns. The array has to be the same length as the number of rows

Parameters

Name Type Description
descriptions string Array
  • Array of descriptions
rows HTMLElement
  • HTML element of the rows

Returns

Void

getDevName(description)

Gets the device name from a description.

Parameters

Name Type Description
description string

Returns

string

Line containing device name, or null if not found

getUserName(description)

Gets the "requested user" name from a description.

Parameters

Name Type Description
description string

Returns

string

Line containing user name, or null if not found

getFromRegex(string, regex)

Gets a result from a regex. Returns null if no match found

Parameters

Name Type Description
string string
  • The string that the regex will perform a match on
regex string
  • Pattern that you want to test for

Returns

string

Line containing regex, or null if not found