Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Global methods

Global methods

Several global methods can be used in encryption rules.

print(String message)

Prints a message to the wrapper log file: <proxy server directory>/logs/wrapper_<date>.log.

This method is available only in an Edge Encryption rule action script.

Table 1. Parameters
Name Type Description
message String The message to be written to the wrapper log file.
Table 2. Returns
Type Description
void

endsWith(String toMatch)

Determines if the string ends with the specified string.

This method is available only in an Edge Encryption rule action script.

Table 3. Parameters
Name Type Description
toMatch String The string to match.
Table 4. Returns
Type Description
Boolean True if the specified string matches the end of the target string.

This example is from the Vacation encryption rule condition.

function VacationCondition(request) {
	if (endsWith(request.path, '/service_catalog.do') &&
		request.postParams.sysparm_action == 'execute_producer' &&
		request.postParams.sysparm_id == 'c322301653a33100c0eca5f4a11c084d')
			return true;
	return false;
}

string.replace(String old, String new)

Creates a new string by replacing an existing sub-string with a new sub-string.

This method is available only in an Edge Encryption rule action script.

Table 5. Parameters
Name Type Description
old String The sub-string to be replaced.
new String The sub-string replacing the old sub-string.
Table 6. Returns
Type Description
String The string with the new sub-string.