Skip to content
Update System Global API authored by Connor Quick's avatar Connor Quick
...@@ -41,14 +41,15 @@ addInfoMessage("This is an informational message."); ...@@ -41,14 +41,15 @@ addInfoMessage("This is an informational message.");
## `base64Decode(String source)` ## `base64Decode(String source)`
**Description:**\ ### Description
Returns an ASCII string from the specified base64 string. Returns an ASCII string from the specified base64 string.
**Parameters:** ### Parameters
- `source` (String): The base64 encoded string. - `source` (String): The base64 encoded string.
**Usage:** ### Usage
```javascript ```javascript
let asciiString = base64Decode("SGVsbG8gd29ybGQ="); let asciiString = base64Decode("SGVsbG8gd29ybGQ=");
...@@ -56,14 +57,15 @@ let asciiString = base64Decode("SGVsbG8gd29ybGQ="); ...@@ -56,14 +57,15 @@ let asciiString = base64Decode("SGVsbG8gd29ybGQ=");
## `base64Encode(String source)` ## `base64Encode(String source)`
**Description:**\ ### Description
Creates a base64 string from the specified string. Creates a base64 string from the specified string.
**Parameters:** ### Parameters
- `source` (String): The string to encode to base64. - `source` (String): The string to encode to base64.
**Usage:** ### Usage
```javascript ```javascript
let base64String = base64Encode("Hello world"); let base64String = base64Encode("Hello world");
...@@ -71,10 +73,11 @@ let base64String = base64Encode("Hello world"); ...@@ -71,10 +73,11 @@ let base64String = base64Encode("Hello world");
## `beginningOfLastMonth()` ## `beginningOfLastMonth()`
**Description:**\ ### Description
Returns the date and time for the beginning of last month in GMT. Returns the date and time for the beginning of last month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningLastMonth = beginningOfLastMonth(); let beginningLastMonth = beginningOfLastMonth();
...@@ -82,10 +85,11 @@ let beginningLastMonth = beginningOfLastMonth(); ...@@ -82,10 +85,11 @@ let beginningLastMonth = beginningOfLastMonth();
## `beginningOfLastWeek()` ## `beginningOfLastWeek()`
**Description:**\ ### Description
Returns the date and time for the beginning of last week in GMT. Returns the date and time for the beginning of last week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningLastWeek = beginningOfLastWeek(); let beginningLastWeek = beginningOfLastWeek();
...@@ -93,10 +97,11 @@ let beginningLastWeek = beginningOfLastWeek(); ...@@ -93,10 +97,11 @@ let beginningLastWeek = beginningOfLastWeek();
## `beginningOfNextMonth()` ## `beginningOfNextMonth()`
**Description:**\ ### Description
Returns the date and time for the beginning of next month in GMT. Returns the date and time for the beginning of next month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningNextMonth = beginningOfNextMonth(); let beginningNextMonth = beginningOfNextMonth();
...@@ -104,10 +109,11 @@ let beginningNextMonth = beginningOfNextMonth(); ...@@ -104,10 +109,11 @@ let beginningNextMonth = beginningOfNextMonth();
## `beginningOfNextWeek()` ## `beginningOfNextWeek()`
**Description:**\ ### Description
Returns the date and time for the beginning of next week in GMT. Returns the date and time for the beginning of next week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningNextWeek = beginningOfNextWeek(); let beginningNextWeek = beginningOfNextWeek();
...@@ -115,10 +121,11 @@ let beginningNextWeek = beginningOfNextWeek(); ...@@ -115,10 +121,11 @@ let beginningNextWeek = beginningOfNextWeek();
## `beginningOfNextYear()` ## `beginningOfNextYear()`
**Description:**\ ### Description
Returns the date and time for the beginning of next year in GMT. Returns the date and time for the beginning of next year in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningNextYear = beginningOfNextYear(); let beginningNextYear = beginningOfNextYear();
...@@ -126,10 +133,11 @@ let beginningNextYear = beginningOfNextYear(); ...@@ -126,10 +133,11 @@ let beginningNextYear = beginningOfNextYear();
## `beginningOfThisMonth()` ## `beginningOfThisMonth()`
**Description:**\ ### Description
Returns the date and time for the beginning of this month in GMT. Returns the date and time for the beginning of this month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningThisMonth = beginningOfThisMonth(); let beginningThisMonth = beginningOfThisMonth();
...@@ -137,10 +145,11 @@ let beginningThisMonth = beginningOfThisMonth(); ...@@ -137,10 +145,11 @@ let beginningThisMonth = beginningOfThisMonth();
## `beginningOfThisQuarter()` ## `beginningOfThisQuarter()`
**Description:**\ ### Description
Returns the date and time for the beginning of this quarter in GMT. Returns the date and time for the beginning of this quarter in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningThisQuarter = beginningOfThisQuarter(); let beginningThisQuarter = beginningOfThisQuarter();
...@@ -148,10 +157,11 @@ let beginningThisQuarter = beginningOfThisQuarter(); ...@@ -148,10 +157,11 @@ let beginningThisQuarter = beginningOfThisQuarter();
## `beginningOfThisWeek()` ## `beginningOfThisWeek()`
**Description:**\ ### Description
Returns the date and time for the beginning of this week in GMT. Returns the date and time for the beginning of this week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningThisWeek = beginningOfThisWeek(); let beginningThisWeek = beginningOfThisWeek();
...@@ -159,10 +169,11 @@ let beginningThisWeek = beginningOfThisWeek(); ...@@ -159,10 +169,11 @@ let beginningThisWeek = beginningOfThisWeek();
## `beginningOfThisYear()` ## `beginningOfThisYear()`
**Description:**\ ### Description
Returns the date and time for the beginning of this year in GMT. Returns the date and time for the beginning of this year in GMT.
**Usage:** ### Usage
```javascript ```javascript
let beginningThisYear = beginningOfThisYear(); let beginningThisYear = beginningOfThisYear();
...@@ -170,14 +181,15 @@ let beginningThisYear = beginningOfThisYear(); ...@@ -170,14 +181,15 @@ let beginningThisYear = beginningOfThisYear();
## `daysAgo(Number days)` ## `daysAgo(Number days)`
**Description:**\ ### Description
Returns the date and time for a specified number of days ago. Returns the date and time for a specified number of days ago.
**Parameters:** ### Parameters
- `days` (Number): The number of days ago. - `days` (Number): The number of days ago.
**Usage:** ### Usage
```javascript ```javascript
let daysAgo = daysAgo(3); let daysAgo = daysAgo(3);
...@@ -185,14 +197,15 @@ let daysAgo = daysAgo(3); ...@@ -185,14 +197,15 @@ let daysAgo = daysAgo(3);
## `daysAgoEnd(Number days)` ## `daysAgoEnd(Number days)`
**Description:**\ ### Description
Returns the date and time for the end of the day a specified number of days ago. Returns the date and time for the end of the day a specified number of days ago.
**Parameters:** ### Parameters
- `days` (Number): The number of days ago. - `days` (Number): The number of days ago.
**Usage:** ### Usage
```javascript ```javascript
let endOfDay = daysAgoEnd(3); let endOfDay = daysAgoEnd(3);
...@@ -200,14 +213,15 @@ let endOfDay = daysAgoEnd(3); ...@@ -200,14 +213,15 @@ let endOfDay = daysAgoEnd(3);
## `daysAgoStart(Number days)` ## `daysAgoStart(Number days)`
**Description:**\ ### Description
Returns the date and time for the beginning of the day a specified number of days ago. Returns the date and time for the beginning of the day a specified number of days ago.
**Parameters:** ### Parameters
- `days` (Number): The number of days ago. - `days` (Number): The number of days ago.
**Usage:** ### Usage
```javascript ```javascript
let startOfDay = daysAgoStart(3); let startOfDay = daysAgoStart(3);
...@@ -215,14 +229,15 @@ let startOfDay = daysAgoStart(3); ...@@ -215,14 +229,15 @@ let startOfDay = daysAgoStart(3);
## `debug(String message)` ## `debug(String message)`
**Description:**\ ### Description
Writes a debug message to the system log. Writes a debug message to the system log.
**Parameters:** ### Parameters
- `message` (String): The debug message to log. - `message` (String): The debug message to log.
**Usage:** ### Usage
```javascript ```javascript
debug("This is a debug message"); debug("This is a debug message");
...@@ -230,10 +245,11 @@ debug("This is a debug message"); ...@@ -230,10 +245,11 @@ debug("This is a debug message");
## `endOfLastMonth()` ## `endOfLastMonth()`
**Description:**\ ### Description
Returns the date and time for the end of last month in GMT. Returns the date and time for the end of last month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfLastMonth = endOfLastMonth(); let endOfLastMonth = endOfLastMonth();
...@@ -241,10 +257,11 @@ let endOfLastMonth = endOfLastMonth(); ...@@ -241,10 +257,11 @@ let endOfLastMonth = endOfLastMonth();
## `endOfLastWeek()` ## `endOfLastWeek()`
**Description:**\ ### Description
Returns the date and time for the end of last week in GMT. Returns the date and time for the end of last week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfLastWeek = endOfLastWeek(); let endOfLastWeek = endOfLastWeek();
...@@ -252,10 +269,11 @@ let endOfLastWeek = endOfLastWeek(); ...@@ -252,10 +269,11 @@ let endOfLastWeek = endOfLastWeek();
## `endOfLastYear()` ## `endOfLastYear()`
**Description:**\ ### Description
Returns the date and time for the end of last year in GMT. Returns the date and time for the end of last year in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfLastYear = endOfLastYear(); let endOfLastYear = endOfLastYear();
...@@ -263,10 +281,11 @@ let endOfLastYear = endOfLastYear(); ...@@ -263,10 +281,11 @@ let endOfLastYear = endOfLastYear();
## `endOfNextMonth()` ## `endOfNextMonth()`
**Description:**\ ### Description
Returns the date and time for the end of next month in GMT. Returns the date and time for the end of next month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfNextMonth = endOfNextMonth(); let endOfNextMonth = endOfNextMonth();
...@@ -274,10 +293,11 @@ let endOfNextMonth = endOfNextMonth(); ...@@ -274,10 +293,11 @@ let endOfNextMonth = endOfNextMonth();
## `endOfNextWeek()` ## `endOfNextWeek()`
**Description:**\ ### Description
Returns the date and time for the end of next week in GMT. Returns the date and time for the end of next week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfNextWeek = endOfNextWeek(); let endOfNextWeek = endOfNextWeek();
...@@ -285,10 +305,11 @@ let endOfNextWeek = endOfNextWeek(); ...@@ -285,10 +305,11 @@ let endOfNextWeek = endOfNextWeek();
## `endOfNextYear()` ## `endOfNextYear()`
**Description:**\ ### Description
Returns the date and time for the end of next year in GMT. Returns the date and time for the end of next year in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfNextYear = endOfNextYear() let endOfNextYear = endOfNextYear()
...@@ -296,10 +317,11 @@ let endOfNextYear = endOfNextYear() ...@@ -296,10 +317,11 @@ let endOfNextYear = endOfNextYear()
## `endOfThisMonth()` ## `endOfThisMonth()`
**Description:**\ ### Description
Returns the date and time for the end of this month in GMT. Returns the date and time for the end of this month in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfThisMonth = endOfThisMonth(); let endOfThisMonth = endOfThisMonth();
...@@ -307,10 +329,11 @@ let endOfThisMonth = endOfThisMonth(); ...@@ -307,10 +329,11 @@ let endOfThisMonth = endOfThisMonth();
## `endOfThisQuarter()` ## `endOfThisQuarter()`
**Description:**\ ### Description
Returns the date and time for the end of this quarter in GMT. Returns the date and time for the end of this quarter in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfThisQuarter = endOfThisQuarter(); let endOfThisQuarter = endOfThisQuarter();
...@@ -318,10 +341,11 @@ let endOfThisQuarter = endOfThisQuarter(); ...@@ -318,10 +341,11 @@ let endOfThisQuarter = endOfThisQuarter();
## `endOfThisWeek()` ## `endOfThisWeek()`
**Description:**\ ### Description
Returns the date and time for the end of this week in GMT. Returns the date and time for the end of this week in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfThisWeek = endOfThisWeek(); let endOfThisWeek = endOfThisWeek();
...@@ -329,10 +353,11 @@ let endOfThisWeek = endOfThisWeek(); ...@@ -329,10 +353,11 @@ let endOfThisWeek = endOfThisWeek();
## `endOfThisYear()` ## `endOfThisYear()`
**Description:**\ ### Description
Returns the date and time for the end of this year in GMT. Returns the date and time for the end of this year in GMT.
**Usage:** ### Usage
```javascript ```javascript
let endOfThisYear = endOfThisYear(); let endOfThisYear = endOfThisYear();
...@@ -340,14 +365,15 @@ let endOfThisYear = endOfThisYear(); ...@@ -340,14 +365,15 @@ let endOfThisYear = endOfThisYear();
## `error(String message)` ## `error(String message)`
**Parameters:** ### Parameters
- `message` (String): The error message to write to the system log. - `message` (String): The error message to write to the system log.
**Description:**\ ### Description
Writes an error message to the system log. Writes an error message to the system log.
**Usage:** ### Usage
```javascript ```javascript
error("This is an error message"); error("This is an error message");
...@@ -355,7 +381,7 @@ error("This is an error message"); ...@@ -355,7 +381,7 @@ error("This is an error message");
## `eventQueue(String name, Object instance, String parm1, String parm2, String queue)` ## `eventQueue(String name, Object instance, String parm1, String parm2, String queue)`
**Parameters:** ### Parameters
- `name` (String): Name of the event. - `name` (String): Name of the event.
- `instance` (Object): An instance object. - `instance` (Object): An instance object.
...@@ -363,10 +389,11 @@ error("This is an error message"); ...@@ -363,10 +389,11 @@ error("This is an error message");
- `parm2` (String): The second parameter. - `parm2` (String): The second parameter.
- `queue` (String): Name of the queue. - `queue` (String): Name of the queue.
**Description:**\ ### Description
Queues an event for the event manager. Queues an event for the event manager.
**Usage:** ### Usage
```javascript ```javascript
eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName"); eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName");
...@@ -374,7 +401,7 @@ eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName") ...@@ -374,7 +401,7 @@ eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName")
## `eventQueueScheduled(String name, Object instance, String parm1, String parm2, Object expiration)` ## `eventQueueScheduled(String name, Object instance, String parm1, String parm2, Object expiration)`
**Parameters:** ### Parameters
- `name` (String): Name of the event. - `name` (String): Name of the event.
- `instance` (Object): An instance object. - `instance` (Object): An instance object.
...@@ -382,10 +409,11 @@ eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName") ...@@ -382,10 +409,11 @@ eventQueue("eventName", instanceObject, "parameter1", "parameter2", "queueName")
- `parm2` (String): The second parameter. - `parm2` (String): The second parameter.
- `expiration` (Object): The expiration object. - `expiration` (Object): The expiration object.
**Description:**\ ### Description
Queues an event in the event manager. The passed in event schedule information is stored in the Events \[sys_events\] table. Queues an event in the event manager. The passed in event schedule information is stored in the Events \[sys_events\] table.
**Usage:** ### Usage
```javascript ```javascript
eventQueueScheduled("eventName", instanceObject, "parameter1", "parameter2", expirationObject); eventQueueScheduled("eventName", instanceObject, "parameter1", "parameter2", expirationObject);
...@@ -393,10 +421,11 @@ eventQueueScheduled("eventName", instanceObject, "parameter1", "parameter2", exp ...@@ -393,10 +421,11 @@ eventQueueScheduled("eventName", instanceObject, "parameter1", "parameter2", exp
## `generateGUID()` ## `generateGUID()`
**Description:**\ ### Description
Generates a GUID that can be used when a unique identifier is required. Generates a GUID that can be used when a unique identifier is required.
**Usage:** ### Usage
```javascript ```javascript
let guid = generateGUID(); let guid = generateGUID();
...@@ -404,10 +433,11 @@ let guid = generateGUID(); ...@@ -404,10 +433,11 @@ let guid = generateGUID();
## `getErrorMessages()` ## `getErrorMessages()`
**Description:**\ ### Description
Returns the error messages that were added by addErrorMessage() for the session. Returns the error messages that were added by addErrorMessage() for the session.
**Usage:** ### Usage
```javascript ```javascript
let errorMessages = getErrorMessages(); let errorMessages = getErrorMessages();
...@@ -415,15 +445,16 @@ let errorMessages = getErrorMessages(); ...@@ -415,15 +445,16 @@ let errorMessages = getErrorMessages();
## `getProperty(String key, Object alt)` ## `getProperty(String key, Object alt)`
**Parameters:** ### Parameters
- `key` (String): The key of the system property. - `key` (String): The key of the system property.
- `alt` (Object): The alternate value to return if the property is not found. - `alt` (Object): The alternate value to return if the property is not found.
**Description:**\ ### Description
Gets the value of a system property from sys_properties. If the property is not found, returns an alternate value. Gets the value of a system property from sys_properties. If the property is not found, returns an alternate value.
**Usage:** ### Usage
```javascript ```javascript
let propertyValue = getProperty("propertyKey", "alternateValue"); let propertyValue = getProperty("propertyKey", "alternateValue");
...@@ -431,10 +462,11 @@ let propertyValue = getProperty("propertyKey", "alternateValue"); ...@@ -431,10 +462,11 @@ let propertyValue = getProperty("propertyKey", "alternateValue");
## `getTimeZoneName()` ## `getTimeZoneName()`
**Description:**\ ### Description
Returns the name of the time zone associated with the current user. Returns the name of the time zone associated with the current user.
**Usage:** ### Usage
```javascript ```javascript
let timeZoneName = getTimeZoneName(); let timeZoneName = getTimeZoneName();
...@@ -442,10 +474,11 @@ let timeZoneName = getTimeZoneName(); ...@@ -442,10 +474,11 @@ let timeZoneName = getTimeZoneName();
## `getUrlOnStack()` ## `getUrlOnStack()`
**Description:**\ ### Description
Gets the current URI for the session. Gets the current URI for the session.
**Usage:** ### Usage
```javascript ```javascript
let url = getUrlOnStack(); let url = getUrlOnStack();
...@@ -453,10 +486,11 @@ let url = getUrlOnStack(); ...@@ -453,10 +486,11 @@ let url = getUrlOnStack();
## `getUser()` ## `getUser()`
**Description:**\ ### Description
Returns a reference to the scoped SystemUser object for the current user. Returns a reference to the scoped SystemUser object for the current user.
**Usage:** ### Usage
```javascript ```javascript
let user = getUser(); let user = getUser();
...@@ -464,10 +498,11 @@ let user = getUser(); ...@@ -464,10 +498,11 @@ let user = getUser();
## `getUserDisplayName()` ## `getUserDisplayName()`
**Description:**\ ### Description
Gets the display name of the current user. Gets the display name of the current user.
**Usage:** ### Usage
```javascript ```javascript
let displayName = getUserDisplayName(); let displayName = getUserDisplayName();
...@@ -475,10 +510,11 @@ let displayName = getUserDisplayName(); ...@@ -475,10 +510,11 @@ let displayName = getUserDisplayName();
## `getUserID()` ## `getUserID()`
**Description:**\ ### Description
Gets the id of the current user. Gets the id of the current user.
**Usage:** ### Usage
```javascript ```javascript
let userId = getUserID(); let userId = getUserID();
...@@ -486,10 +522,11 @@ let userId = getUserID(); ...@@ -486,10 +522,11 @@ let userId = getUserID();
## `getUserName()` ## `getUserName()`
**Description:**\ ### Description
Gets the user name, or user id, of the current user. Gets the user name, or user id, of the current user.
**Usage:** ### Usage
```javascript ```javascript
let userName = getUserName(); let userName = getUserName();
...@@ -497,14 +534,15 @@ let userName = getUserName(); ...@@ -497,14 +534,15 @@ let userName = getUserName();
## `hasRole(role)` ## `hasRole(role)`
**Description:**\ ### Description
Determines if the current user has the specified role. Determines if the current user has the specified role.
**Parameters:** ### Parameters
- `role`: Object - The role to check for. - `role`: Object - The role to check for.
**Usage:** ### Usage
```javascript ```javascript
let hasRoleAdmin = hasRole('admin'); let hasRoleAdmin = hasRole('admin');
...@@ -512,14 +550,15 @@ let hasRoleAdmin = hasRole('admin'); ...@@ -512,14 +550,15 @@ let hasRoleAdmin = hasRole('admin');
## `hoursAgo(hours)` ## `hoursAgo(hours)`
**Description:**\ ### Description
Returns the date and time for a specified number of hours ago. Returns the date and time for a specified number of hours ago.
**Parameters:** ### Parameters
- `hours`: Number - The number of hours ago. - `hours`: Number - The number of hours ago.
**Usage:** ### Usage
```javascript ```javascript
let timeFewHoursAgo = hoursAgo(3); let timeFewHoursAgo = hoursAgo(3);
...@@ -527,14 +566,15 @@ let timeFewHoursAgo = hoursAgo(3); ...@@ -527,14 +566,15 @@ let timeFewHoursAgo = hoursAgo(3);
## `hoursAgoEnd(hours)` ## `hoursAgoEnd(hours)`
**Description:**\ ### Description
Returns the date and time for the end of the hour a specified number of hours ago. Returns the date and time for the end of the hour a specified number of hours ago.
**Parameters:** ### Parameters
- `hours`: Number - The number of hours ago. - `hours`: Number - The number of hours ago.
**Usage:** ### Usage
```javascript ```javascript
let timeHoursAgoEnd = hoursAgoEnd(3); let timeHoursAgoEnd = hoursAgoEnd(3);
...@@ -542,14 +582,15 @@ let timeHoursAgoEnd = hoursAgoEnd(3); ...@@ -542,14 +582,15 @@ let timeHoursAgoEnd = hoursAgoEnd(3);
## `hoursAgoStart(hours)` ## `hoursAgoStart(hours)`
**Description:**\ ### Description
Returns the date and time for the start of the hour a specified number of hours ago. Returns the date and time for the start of the hour a specified number of hours ago.
**Parameters:** ### Parameters
- `hours`: Number - The number of hours ago. - `hours`: Number - The number of hours ago.
**Usage:** ### Usage
```javascript ```javascript
let timeHoursAgoStart = hoursAgoStart(3); let timeHoursAgoStart = hoursAgoStart(3);
...@@ -557,14 +598,15 @@ let timeHoursAgoStart = hoursAgoStart(3); ...@@ -557,14 +598,15 @@ let timeHoursAgoStart = hoursAgoStart(3);
## `include(name)` ## `include(name)`
**Description:**\ ### Description
Provides a safe way to call a script include from the sandbox, allowing only the inclusion of trusted scripts. Provides a safe way to call a script include from the sandbox, allowing only the inclusion of trusted scripts.
**Parameters:** ### Parameters
- `name`: String - The name of the script to include. - `name`: String - The name of the script to include.
**Usage:** ### Usage
```javascript ```javascript
include('myScript'); include('myScript');
...@@ -572,14 +614,15 @@ include('myScript'); ...@@ -572,14 +614,15 @@ include('myScript');
## `info(message)` ## `info(message)`
**Description:**\ ### Description
Writes an info message to the system log. Writes an info message to the system log.
**Parameters:** ### Parameters
- `message`: String - The message to log. - `message`: String - The message to log.
**Usage:** ### Usage
```javascript ```javascript
info('This is an info message.'); info('This is an info message.');
...@@ -587,14 +630,15 @@ info('This is an info message.'); ...@@ -587,14 +630,15 @@ info('This is an info message.');
## `minutesAgoEnd(minutes)` ## `minutesAgoEnd(minutes)`
**Description:**\ ### Description
Returns the date and time for the end of the minute a specified number of minutes ago. Returns the date and time for the end of the minute a specified number of minutes ago.
**Parameters:** ### Parameters
- `minutes`: Number - The number of minutes ago. - `minutes`: Number - The number of minutes ago.
**Usage:** ### Usage
```javascript ```javascript
let timeMinutesAgoEnd = minutesAgoEnd(30); let timeMinutesAgoEnd = minutesAgoEnd(30);
...@@ -602,14 +646,15 @@ let timeMinutesAgoEnd = minutesAgoEnd(30); ...@@ -602,14 +646,15 @@ let timeMinutesAgoEnd = minutesAgoEnd(30);
## `minutesAgoStart(minutes)` ## `minutesAgoStart(minutes)`
**Description:**\ ### Description
Returns the date and time for the start of the minute a specified number of minutes ago. Returns the date and time for the start of the minute a specified number of minutes ago.
**Parameters:** ### Parameters
- `minutes`: Number - The number of minutes ago. - `minutes`: Number - The number of minutes ago.
**Usage:** ### Usage
```javascript ```javascript
let timeMinutesAgoStart = minutesAgoStart(30); let timeMinutesAgoStart = minutesAgoStart(30);
...@@ -617,14 +662,15 @@ let timeMinutesAgoStart = minutesAgoStart(30); ...@@ -617,14 +662,15 @@ let timeMinutesAgoStart = minutesAgoStart(30);
## `monthsAgo(months)` ## `monthsAgo(months)`
**Description:**\ ### Description
Returns the date and time for a specified number of months ago. Returns the date and time for a specified number of months ago.
**Parameters:** ### Parameters
- `months`: Number - The number of months ago. - `months`: Number - The number of months ago.
**Usage:** ### Usage
```javascript ```javascript
let timeMonthsAgo = monthsAgo(3); let timeMonthsAgo = monthsAgo(3);
...@@ -632,14 +678,15 @@ let timeMonthsAgo = monthsAgo(3); ...@@ -632,14 +678,15 @@ let timeMonthsAgo = monthsAgo(3);
## `monthsAgoStart(months)` ## `monthsAgoStart(months)`
**Description:**\ ### Description
Returns the date and time for the start of the month a specified number of months ago. Returns the date and time for the start of the month a specified number of months ago.
**Parameters:** ### Parameters
- `months`: Number - The number of months ago. - `months`: Number - The number of months ago.
**Usage:** ### Usage
```javascript ```javascript
let timeMonthsAgoStart = monthsAgoStart(3); let timeMonthsAgoStart = monthsAgoStart(3);
...@@ -647,14 +694,15 @@ let timeMonthsAgoStart = monthsAgoStart(3); ...@@ -647,14 +694,15 @@ let timeMonthsAgoStart = monthsAgoStart(3);
## `nil(o)` ## `nil(o)`
**Description:**\ ### Description
Queries an object and returns true if the object is null, undefined, or contains an empty string. Queries an object and returns true if the object is null, undefined, or contains an empty string.
**Parameters:** ### Parameters
- `o`: Object - The object to query. - `o`: Object - The object to query.
**Usage:** ### Usage
```javascript ```javascript
let isNull = nil(myObject); let isNull = nil(myObject);
...@@ -662,14 +710,15 @@ let isNull = nil(myObject); ...@@ -662,14 +710,15 @@ let isNull = nil(myObject);
## `quartersAgoEnd(quarters)` ## `quartersAgoEnd(quarters)`
**Description:**\ ### Description
Returns the date and time for the last day of the quarter for a specified number of quarters ago. Returns the date and time for the last day of the quarter for a specified number of quarters ago.
**Parameters:** ### Parameters
- `quarters`: Number - The number of quarters ago. - `quarters`: Number - The number of quarters ago.
**Usage:** ### Usage
```javascript ```javascript
let timeQuartersAgoEnd = quartersAgoEnd(2); let timeQuartersAgoEnd = quartersAgoEnd(2);
...@@ -677,14 +726,15 @@ let timeQuartersAgoEnd = quartersAgoEnd(2); ...@@ -677,14 +726,15 @@ let timeQuartersAgoEnd = quartersAgoEnd(2);
## `quartersAgoStart(quarters)` ## `quartersAgoStart(quarters)`
**Description:**\ ### Description
Returns the date and time for the first day of the quarter for a specified number of quarters ago. Returns the date and time for the first day of the quarter for a specified number of quarters ago.
**Parameters:** ### Parameters
- `quarters`: Number - The number of quarters ago. - `quarters`: Number - The number of quarters ago.
**Usage:** ### Usage
```javascript ```javascript
let timeQuartersAgoStart = quartersAgoStart(2); let timeQuartersAgoStart = quartersAgoStart(2);
...@@ -692,16 +742,17 @@ let timeQuartersAgoStart = quartersAgoStart(2); ...@@ -692,16 +742,17 @@ let timeQuartersAgoStart = quartersAgoStart(2);
## `setProperty(key, value, description)` ## `setProperty(key, value, description)`
**Description:**\ ### Description
Sets the specified key to the specified value if the property is within the script's scope. Sets the specified key to the specified value if the property is within the script's scope.
**Parameters:** ### Parameters
- `key`: String - The property key. - `key`: String - The property key.
- `value`: String - The property value. - `value`: String - The property value.
- `description`: String - The property description. - `description`: String - The property description.
**Usage:** ### Usage
```javascript ```javascript
setProperty('myKey', 'myValue', 'This is a property description'); setProperty('myKey', 'myValue', 'This is a property description');
...@@ -709,14 +760,15 @@ setProperty('myKey', 'myValue', 'This is a property description'); ...@@ -709,14 +760,15 @@ setProperty('myKey', 'myValue', 'This is a property description');
## `setRedirect(o)` ## `setRedirect(o)`
**Description:**\ ### Description
Sets the redirect URI for this transaction, which then determines the next page the user will see. Sets the redirect URI for this transaction, which then determines the next page the user will see.
**Parameters:** ### Parameters
- `o`: Object - The URI to redirect to. - `o`: Object - The URI to redirect to.
**Usage:** ### Usage
```javascript ```javascript
setRedirect(myURI); setRedirect(myURI);
...@@ -724,14 +776,15 @@ setRedirect(myURI); ...@@ -724,14 +776,15 @@ setRedirect(myURI);
## `tableExists(name)` ## `tableExists(name)`
**Description:**\ ### Description
Determines if a database table exists. Determines if a database table exists.
**Parameters:** ### Parameters
- `name`: String - The name of the table. - `name`: String - The name of the table.
**Usage:** ### Usage
```javascript ```javascript
let doesTableExist = tableExists('myTable'); let doesTableExist = tableExists('myTable');
...@@ -739,14 +792,15 @@ let doesTableExist = tableExists('myTable'); ...@@ -739,14 +792,15 @@ let doesTableExist = tableExists('myTable');
## `urlDecode(url)` ## `urlDecode(url)`
**Description:**\ ### Description
Replaces UTF-8 encoded characters with ASCII characters. Replaces UTF-8 encoded characters with ASCII characters.
**Parameters:** ### Parameters
- `url`: String - The URL to decode. - `url`: String - The URL to decode.
**Usage:** ### Usage
```javascript ```javascript
let decodedUrl = urlDecode('https%3A%2F%2Fexample.com'); let decodedUrl = urlDecode('https%3A%2F%2Fexample.com');
...@@ -754,14 +808,15 @@ let decodedUrl = urlDecode('https%3A%2F%2Fexample.com'); ...@@ -754,14 +808,15 @@ let decodedUrl = urlDecode('https%3A%2F%2Fexample.com');
## `urlEncode(url)` ## `urlEncode(url)`
**Description:**\ ### Description
Encodes non-ASCII characters, unsafe ASCII characters, and spaces so the returned string can be used on the Internet. Uses UTF-8 encoding. Uses percent (%) encoding. Encodes non-ASCII characters, unsafe ASCII characters, and spaces so the returned string can be used on the Internet. Uses UTF-8 encoding. Uses percent (%) encoding.
**Parameters:** ### Parameters
- `url`: String - The URL to encode. - `url`: String - The URL to encode.
**Usage:** ### Usage
```javascript ```javascript
let encodedUrl = urlEncode('https://example.com'); let encodedUrl = urlEncode('https://example.com');
...@@ -769,14 +824,15 @@ let encodedUrl = urlEncode('https://example.com'); ...@@ -769,14 +824,15 @@ let encodedUrl = urlEncode('https://example.com');
## `warn(message)` ## `warn(message)`
**Description:**\ ### Description
Writes a warning message to the system log. Writes a warning message to the system log.
**Parameters:** ### Parameters
- `message`: String - The warning message to log. - `message`: String - The warning message to log.
**Usage:** ### Usage
```javascript ```javascript
warn('This is a warning message'); warn('This is a warning message');
...@@ -784,14 +840,15 @@ warn('This is a warning message'); ...@@ -784,14 +840,15 @@ warn('This is a warning message');
## `xmlToJSON(xmlString)` ## `xmlToJSON(xmlString)`
**Description:**\ ### Description
Takes an XML string and returns a JSON object. Takes an XML string and returns a JSON object.
**Parameters:** ### Parameters
- `xmlString`: String - The XML string to convert. - `xmlString`: String - The XML string to convert.
**Usage:** ### Usage
```javascript ```javascript
let jsonObject = xmlToJSON('<root><test>value</test></root>'); let jsonObject = xmlToJSON('<root><test>value</test></root>');
...@@ -799,14 +856,15 @@ let jsonObject = xmlToJSON('<root><test>value</test></root>'); ...@@ -799,14 +856,15 @@ let jsonObject = xmlToJSON('<root><test>value</test></root>');
## `yearsAgo(years)` ## `yearsAgo(years)`
**Description:**\ ### Description
Returns a date and time for a certain number of years ago. Returns a date and time for a certain number of years ago.
**Parameters:** ### Parameters
- `years`: Number - The number of years ago. - `years`: Number - The number of years ago.
**Usage:** ### Usage
```javascript ```javascript
let timeYearsAgo = yearsAgo(5); let timeYearsAgo = yearsAgo(5);
...@@ -814,10 +872,11 @@ let timeYearsAgo = yearsAgo(5); ...@@ -814,10 +872,11 @@ let timeYearsAgo = yearsAgo(5);
## `yesterday()` ## `yesterday()`
**Description:**\ ### Description
Returns yesterday's time (24 hours ago). Returns yesterday's time (24 hours ago).
**Usage:** ### Usage
```javascript ```javascript
let timeYesterday = yesterday(); let timeYesterday = yesterday();
... ...
......