The script module is automatically imported as script
.
Represents the currently running script. The script object includes the following:
_id
(ObjectId) the script identifieraccess
(Number) the acl level of access to the current in-context subjectarguments
(Object) the script arguments object. In triggers, there are old and new
properties that represent the original and modifications made to the access context subject.depth
(Number) the 1-indexed script depth (a trigger firing trigger would have a depth of 2).label
(String) the script label.env
(Object) the current api environmenthost
(String) the api host (api.medable.com or api.dev.medable.com)name
(String) the environment name (production/development)url
(String) the api base endpoint (eg. https://api.medable.com/my_org/v2)version
(String) the current api version string
org
(CortexObject)_id
(ObjectId) the org identifiercode
(String) the org code
originalPrincipal
(ObjectId) The identifier of the principal who originally called the script.
This may differ from the script principal if it was configured to run as a specific account.principal
(CortexObject)_id
(ObjectId) the identifier of the principal who called the script.email
(String) the principal's email addressname
(Object)
-first
(String) the principal's first name
-last
(String) the principal's last name
roles
(ObjectId[]) a list of the principal's assigned org roles
type
(String) the script type (trigger, route, job)
Methods
getOpsRemaining()
getOpsUsed()
getTimeLeft()
getElapsedTime()
getCalloutsRemaining()
getNotificationsRemaining()
getOpsRemaining()
Returns the number of byte code operations available to the script.
Returns
Number
getOpsUsed()
Returns the number of byte code operations consumed by the script.
Returns
Number
getTimeLeft()
Returns the number of milliseconds remaining to the script before a timeout error is triggered.
Returns
Number
getElapsedTime()
Returns the number of milliseconds since the start of the script.
Returns
Number
getCalloutsRemaining()
Returns the number of http callouts available to the current running script.
Returns
Number
getNotificationsRemaining()
Returns the number of notifications.send() calls available to the current running script.
Returns
Number