Context
The Context Object¶
The Context object is a JavaScript object containing useful information for writing eLegere scripts. It is available in every eLegere Script through the context variable. A list of keys for this object and the corresponding values is presented below.
Abstract
Each entry lists a object of eLegere Script and their use within a function or a class.
Url string
¶
A string containing the URL of the current eLegere Environment.
An Example:
1 2 |
|
DomainId string
¶
A string containing the Id of the Domain in which the script will run. It identifies the eLegere Domain through a unique alpha-numeric string.
1 2 |
|
TimezoneMSOffset number
¶
1 |
|
Number of offset milliseconds between the eLegere database time zone and UTC time. If the eLegere database changes with the daylight saving time changes, this variable will reflect the change. This permits an easy conversion between database values and UTC in order to communicate with external APIs. The User should use it with the formulas for Time and Date conversion.
An Example: If the database is using the Central European Summer Time, the shift between CEST and UTC will be 2 hours, equal to 7200000 milliseconds
SessionToken string
¶
1 |
|
An Authentication Token required by the eLegere API. It identifies the user that is currently performing or triggering an action. This value is null
when the script runs through a Scheduled Job since jobs are not associated to a specific user.
Warning
Do not manipulate in any way the SessionToken string. Such behavior can cause errors in the authentication.
ApplicationId string
¶
1 |
|
A string containing the id of the Application in which the script will run. It identifies the eLegere Application through a unique alpha-numeric string. This value is null
when the script runs through a Scheduled Job since jobs are not associated to a specific application.
An Example:
1 2 |
|
A User can retrive an ApplicationId through the application's tile in the Home of eLegere. Click on the icon on the application tile. Then click on "Copy Application Id" and paste the Id in the eLegere script.
UserInfo object
¶
1 |
|
The UserInfo object contains the details of the User who has executed (or triggered the execution) of the script. It contains only an Email key: a string containing the email address of the user that triggered the script.
The whole object is null
when the script is executed through a Scheduled Job since jobs are not associated to a specific user.
An Example:
1 2 3 4 |
|
NewItem object
¶
1 |
|
A JavaScript object that represents an eLegere row after any modification on the row. Each key stands for the name of a Storage field. The value is the row's value stored in that field. The object is null if:
- The script is executed through a Scheduled Job.
- The script runs in the Application execution context.
- The script runs after a PRE ROW DELETE or POST ROW DELETE trigger.
An Example:
1 2 3 4 5 6 |
|
OldItem object
¶
1 |
|
A JavaScript object that represents an eLegere row before any modification on the row. Each key stands for the name of a Storage field. The value is the row's value stored in that field. The object is null if:
- The script is executed through a Scheduled Job
- The script runs in the Application execution context
- The script runs after a PRE ROW INSERT or POST ROW INSERT trigger.
An Example:
1 2 3 4 5 6 7 8 9 |
|
MasterRow object
¶
1 |
|
A JavaScript object representing the eLegere master row related to the detail row on which the eLegere script is being executed. Each key stands for the name of a Storage field. The value is the row's value stored in that field. The object is null if:
- The script is executed through a Scheduled Job
- The script runs through the Application execution context.
- The script runs through the Row execution context, but on the Application's Master table.
An Example:
1 2 3 4 5 6 7 |
|