Script¶
Provides utility functions for scripts.
1 | |
Remarks¶
In server scripts, Script provides:
- checks that stop the script with a message: Script.Assert, Script.AssertEquals and Script.AssertNotEquals
- control over transactions and time: Script.Isolated, Script.Timeout and Script.ThrowIfCancelled
- text conversion with a selected encoding: Script.ToBase64 and Script.FromBase64
- identifiers: Script.NewId
Browser form scripts provide only Script.NewId.
Examples¶
Stop when required data is missing¶
1 | |
Capabilities¶
Assertions¶
- Script.Assert: Fails the current server workflow script when
conditionis false. - Script.AssertEquals: Fails the current server workflow script unless the values are equal.
- Script.AssertNotEquals: Fails the current server workflow script when the values are equal.
Utilities¶
- Script.FromBase64: Decodes Base64 text using a server text encoding.
- Script.NewId: Creates a new UUID/GUID-formatted identifier.
- Script.ToBase64: Encodes text as Base64 using a server text encoding.
Execution Control¶
- Script.Isolated: Runs a callback in a new, independent database transaction.
- Script.ThrowIfCancelled: Throws when the current server script has been cancelled.
- Script.Timeout: Executes a callback with a server-side time limit.