Skip to main content

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

  1. Configuration
  2. ExecutionContext
  3. Message Return Control
  4. Global and Secret Variables
  5. JWrapper
  6. Logger
  7. HttpWrapper
  8. MetadataService
  9. LogEntry
  10. CustomHttpRequest
  11. CustomHttpResponse
  12. Security Notes
  13. Usage Examples
  14. Recent Updates
  15. 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

TypeNameDescription
LoggerLoggerProvides logging functionality for the execution context
HttpWrapperHttpProvides HTTP client functionality for making web requests
JWrapperDataProvides access to JSON data manipulation and querying
MetadataServiceMetadataProvides access to metadata operations
TrasformationResultReturnProvides methods to control message outcome (Skip, Error, Success)
VariablesVariablesProvides access to configured global and secret variables

Message Return Control

You can control the processing outcome of a single message using the Return property.

Available methods

MethodEffect
Return.Skip(string message)Marks the message as ignored (Ignore), so it is not processed by the destination
Return.Error(string message)Marks the message as error (Error), so it is not processed by the destination
Return.Success(object data)Continues processing (Continue) optionally with a new payload

For Skip and Error, the message parameter is shown in the message Error Message field.

Examples

// Ignore the message without sending it to destination
return Return.Skip("Missing SKU: cannot process record");
// Stop the message with error without sending it to destination
return Return.Error("Invalid payload format");
// Continue with original payload
return Return.Success(Data);
// Continue with transformed payload
var mapped = new
{
id = Data.GetString("id"),
externalCode = Data.GetString("code")
};
return Return.Success(mapped);

Global and Secret Variables

You can access global variables and secrets through the Variables property.

Available methods

MethodDescription
Variables.GetSecret(string key)Returns a value from secrets
Variables.GetVariable(string key)Returns a value from global variables
Variables.Get(string key)Looks up secrets first, then global variables

Examples

// Read a global variable
var environment = Variables.GetVariable("environment");

// Read a secret
var apiKey = Variables.GetSecret("external-api-key");

// Read from secrets first, then globals
var endpoint = Variables.Get("target-endpoint");

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

MethodReturn TypeDescription
Get(string jsonPath)objectGets a value from the JSON using the specified path
GetGeneric<T>(string jsonPath)TGets a typed value from the JSON with security checks
GetString(string jsonPath)stringGets 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

MethodReturn TypeDescription
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

MethodReturn TypeDescription
GetChild(string jsonPath)JWrapperReturns 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

MethodReturn TypeDescription
Set(string jsonPath, object value)voidSets a value at the specified JSON path using dot notation or bracket notation
ToString()stringReturns 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

MethodReturn TypeDescription
GetLogs()List<LogEntry>Returns all log entries
Clear()voidClears all log entries
Log(string message)voidAdds a new log entry with the specified message and current timestamp
Log(string message, params object[] args)voidAdds 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

MethodReturn TypeDescription
Execute(CustomHttpRequest request)CustomHttpResponseExecutes an HTTP request and returns the response
ExecuteRest(CustomHttpRequest request)JWrapperExecutes 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

MethodReturn TypeDescription
Get(string key)objectGets metadata value by key using the preconfigured API key
GetTargeted(string key, string target, string id)voidExecutes a "GetTargeted" call synchronously
Set(string key, string value)objectSets metadata value by key using the preconfigured API key
SetTargeted(string key, string value, string target, string id)voidExecutes 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

TypeNameDescription
DateTimeDateThe timestamp when the log entry was created
stringMessageThe log message content
LogLevelLogLevelThe 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

TypeNameDescription
stringUrlThe target URL for the HTTP request
stringMethodThe HTTP method (defaults to "GET")
StringBuilderBodyThe request body as a StringBuilder
JWrapperJsonBodyThe request body as a JWrapper object
Dictionary<string, string>QueryQuery parameters for the request
Dictionary<string, string>PostPOST form data parameters
Dictionary<string, string>HeadersHTTP 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

TypeNameDescription
intStatusThe HTTP status code
Dictionary<string, string>HeadersThe response headers
stringBodyThe response body content

Security Notes

  • The JWrapper class includes security restrictions that prevent access to internal JToken types (JToken, JObject, JArray, JValue, JProperty) for security reasons.
  • The HttpWrapper class 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.
  • Pay special attention when using global and secret variables: use GetSecret for sensitive values, avoid logging secrets, and do not include them in outgoing payloads.

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 Log method now supports a version with params object[] args parameter for string formatting using string.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 JWrapper objects from a specified JSON path, supporting both arrays and single objects.
  • Enhanced Monaco completion support: All methods now include MonacoCompletitionMethodAttribute for 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.