Low Code Reference
This document provides a comprehensive reference for all classes contained in the ExecutionContext and their related components used in the Low Code system.
Low Code Actions allow you to write C# scripts directly within the application to process message data before it is sent to the target platform.
Compared to mapping, these Actions offer much more control and flexibility, enabling the execution of more complex operations, such as:
- HTTP calls to external services.
- Saving metadata or additional information.
- Writing custom logs.
- Data manipulation.
Table of Contents
- Configuration
- ExecutionContext
- JWrapper
- Logger
- HttpWrapper
- MetadataService
- LogEntry
- CustomHttpRequest
- CustomHttpResponse
- Security Notes
- Usage Examples
- Recent Updates
- Testing
Configuration
By accessing the Action detail page, you can:
- Write the C# script in the integrated editor.
- Modify the name of the Action.
- Update the settings.
- Test the script.
- Save the changes made.
ExecutionContext
Purpose: The main context class that provides access to all available services and data within a Low Code execution environment. It serves as the central hub for accessing logging, HTTP operations, data manipulation, and metadata services.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Properties
| Type | Name | Description |
|---|---|---|
Logger | Logger | Provides logging functionality for the execution context |
HttpWrapper | Http | Provides HTTP client functionality for making web requests |
JWrapper | Data | Provides access to JSON data manipulation and querying |
MetadataService | Metadata | Provides access to metadata operations |
JWrapper
Purpose: A wrapper class for JSON data manipulation that provides a secure and convenient way to access and modify JSON objects. It includes security restrictions to prevent access to internal JToken types and supports JSONPath queries for data extraction.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Methods
Get Methods
| Method | Return Type | Description |
|---|---|---|
Get(string jsonPath) | object | Gets a value from the JSON using the specified path |
GetGeneric<T>(string jsonPath) | T | Gets a typed value from the JSON with security checks |
GetString(string jsonPath) | string | Gets a string value from the JSON |
GetInt(string jsonPath) | int? | Gets an integer value from the JSON |
GetBool(string jsonPath) | bool? | Gets a boolean value from the JSON |
GetDouble(string jsonPath) | double? | Gets a double value from the JSON |
GetFloat(string jsonPath) | float? | Gets a float value from the JSON |
GetLong(string jsonPath) | long? | Gets a long value from the JSON |
GetDateTime(string jsonPath) | DateTime? | Gets a DateTime value from the JSON |
GetGuid(string jsonPath) | Guid? | Gets a Guid value from the JSON |
List Methods
| Method | Return Type | Description |
|---|---|---|
GetListGeneric<T>(string jsonPath) | List<T> | Gets a list of typed values from the JSON with security checks |
GetListString(string jsonPath) | List<string> | Gets a list of string values from the JSON |
GetListInt(string jsonPath) | List<int?> | Gets a list of integer values from the JSON |
GetListBool(string jsonPath) | List<bool?> | Gets a list of boolean values from the JSON |
GetListDouble(string jsonPath) | List<double?> | Gets a list of double values from the JSON |
GetListFloat(string jsonPath) | List<float?> | Gets a list of float values from the JSON |
GetListLong(string jsonPath) | List<long?> | Gets a list of long values from the JSON |
GetListDateTime(string jsonPath) | List<DateTime?> | Gets a list of DateTime values from the JSON |
GetListGuid(string jsonPath) | List<Guid?> | Gets a list of Guid values from the JSON |
Object Methods
| Method | Return Type | Description |
|---|---|---|
GetChild(string jsonPath) | JWrapper | Returns a JWrapper object for the specified JSON path |
GetListChildren(string jsonPath) | List<JWrapper> | Returns a list of JWrapper objects from the specified JSON path |
Utility Methods
| Method | Return Type | Description |
|---|---|---|
Set(string jsonPath, object value) | void | Sets a value at the specified JSON path using dot notation or bracket notation |
ToString() | string | Returns the JSON representation of the wrapped object |
Logger
Purpose: Provides logging functionality within the Low Code execution context. It maintains a collection of log entries that can be retrieved and cleared as needed. Supports both simple string logging and formatted string logging with parameters.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Methods
| Method | Return Type | Description |
|---|---|---|
GetLogs() | List<LogEntry> | Returns all log entries |
Clear() | void | Clears all log entries |
Log(string message) | void | Adds a new log entry with the specified message and current timestamp |
Log(string message, params object[] args) | void | Adds a new log entry with formatted message using string.Format and current timestamp |
HttpWrapper
Purpose: Provides HTTP client functionality for making web requests within the Low Code execution context. It includes rate limiting (max 10 calls per execution) and supports various HTTP methods, headers, query parameters, and request bodies.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Methods
| Method | Return Type | Description |
|---|---|---|
Execute(CustomHttpRequest request) | CustomHttpResponse | Executes an HTTP request and returns the response |
ExecuteRest(CustomHttpRequest request) | JWrapper | Executes an HTTP request and returns the response body as a JWrapper (throws exception if status is not 2xx) |
ExecuteArrayRest(CustomHttpRequest request) | List<JWrapper> | Executes an HTTP request and returns the response body as a list of JWrapper objects (throws exception if status is not 2xx) |
MetadataService
Purpose: Provides access to metadata operations within the Low Code execution context. It allows synchronous operations for getting and setting metadata values with a fixed 10-second timeout.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Methods
| Method | Return Type | Description |
|---|---|---|
Get(string key) | object | Gets metadata value by key using the preconfigured API key |
GetTargeted(string key, string target, string id) | void | Executes a "GetTargeted" call synchronously |
Set(string key, string value) | object | Sets metadata value by key using the preconfigured API key |
SetTargeted(string key, string value, string target, string id) | void | Executes a "SetTargeted" call synchronously |
LogEntry
Purpose: Represents a single log entry with timestamp, message, and log level information.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Properties
| Type | Name | Description |
|---|---|---|
DateTime | Date | The timestamp when the log entry was created |
string | Message | The log message content |
LogLevel | LogLevel | The severity level of the log entry (defaults to Information) |
CustomHttpRequest
Purpose: Represents a custom HTTP request configuration with support for various HTTP methods, headers, query parameters, and different types of request bodies.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Properties
| Type | Name | Description |
|---|---|---|
string | Url | The target URL for the HTTP request |
string | Method | The HTTP method (defaults to "GET") |
StringBuilder | Body | The request body as a StringBuilder |
JWrapper | JsonBody | The request body as a JWrapper object |
Dictionary<string, string> | Query | Query parameters for the request |
Dictionary<string, string> | Post | POST form data parameters |
Dictionary<string, string> | Headers | HTTP headers for the request |
CustomHttpResponse
Purpose: Represents the response from an HTTP request, including status code, headers, and response body.
Namespace: Sintra.SystemIntegrator.LowCode.Script.Context
Properties
| Type | Name | Description |
|---|---|---|
int | Status | The HTTP status code |
Dictionary<string, string> | Headers | The response headers |
string | Body | The response body content |
Security Notes
- The
JWrapperclass includes security restrictions that prevent access to internal JToken types (JToken,JObject,JArray,JValue,JProperty) for security reasons. - The
HttpWrapperclass includes rate limiting to prevent excessive HTTP calls (maximum 10 calls per execution). - All metadata operations have a fixed 10-second timeout to prevent hanging operations.
Usage Examples
Accessing Data
// Get a string value
string name = Data.GetString("user.name");
// Get a list of objects
List<JWrapper> users = Data.GetListChildren("users");
// Set a value
Data.Set("user.email", "user@example.com");
Making HTTP Requests
var request = new CustomHttpRequest
{
Url = "https://api.example.com/users",
Method = "POST",
Headers = new Dictionary<string, string> { {"Authorization", "Bearer token"} },
JsonBody = Data.GetChild("userData")
};
var response = Http.ExecuteRest(request);
Logging
// Simple logging
Logger.Log("Processing user data");
// Formatted logging with parameters
Logger.Log("Processing user {0} with ID {1}", userName, userId);
var logs = Logger.GetLogs();
Metadata Operations
var config = Metadata.Get("app.config");
Metadata.Set("user.preference", "dark_mode");
Recent Updates
Logger Class Enhancements
- Added formatted logging support: The
Logmethod now supports a version withparams object[] argsparameter for string formatting usingstring.Format(). - Enhanced logging capabilities: Developers can now use formatted strings with placeholders for more dynamic log messages.
JWrapper Class Enhancements
- Added GetListChildren method: New method that returns a list of
JWrapperobjects from a specified JSON path, supporting both arrays and single objects. - Enhanced Monaco completion support: All methods now include
MonacoCompletitionMethodAttributefor better IDE integration and autocomplete functionality.
Testing
Once the script is defined, it can be tested by providing a sample input JSON.
- Before running the test, all changes must be saved.
- The platform will report any errors, allowing you to correct them immediately.
💡 Tip: Always run a test with a small data sample before applying the script to the entire workflow.