Context Object - Runtime Data Access | Circuit | Online Help | Input and Output Processing in Circuit

Context Object

Context Object is used to access runtime information during the Circuit execution. It contains data related to the circuit, state, execution, task, and more. By understanding its structure and how to access it, you can dynamically utilize runtime data within your workflows, thereby improving the efficiency and adaptability of your workflow automation.

The Context Object can be accessed from all JSON Path fields within Circuit, retrieving comprehensive information about the ongoing execution directly from the server, rather than the input.

The provided examples and syntax guidelines, help you to seamlessly integrate the Circuit Context Object into your workflows for more contextual and data-driven execution.

The Context Object is structured as follows:

{
"portal": {
"id": "string", // unique identifier of the org
"name": "string" // name of the org
   },
   "requestor": {
"id": "string", // unique identifier for the requestor
"name": "string", // name of the requestor
"email": "string", // email of the requestor
"first_name": "string", // first name of the requestor
"last_name": "string", // last name of the requestor
"timezone": "string" // timezone of the requestor
   },
  "circuit": {
"id": "string", // unique identifier for the circuit
"name": "string" // name of the circuit
   },
  "execution": {
"id": "string", // unique identifier for the execution
"name": "string", // name of the execution
"description": "string", // description of the execution
"parent_execution": {
"name": "string", // name of the execution
"description": "string", // description of the execution
"type": "string", // type of execution (e.g. api, sdk,test-run)
"origin": "string", // name of the service origin being executed
"start_time": "ISO 8601” // timestamp for when the execution      started
  },
  "type": "string", // type of execution (e.g. api, sdk, test-run)  
  "origin": "string", // name of the service origin being executed
  "start_time": "ISO 8601", // timestamp for when the execution started
  "meta": {} // metadata associated with the execution
   },
   "current_state": {
"name": "string", // name of the current state in the execution
"type": "string", // type of the current state (e.g. function, circuit, webhook, etc.)
"start_time": "ISO 8601" // timestamp for when the current state started
},
"integration": {
"id": "string", // unique identifier for the integration
"name": "string", // name of the integration
"service": "string", // name of the service for the integration
"service_id": "string", // unique identifier for the service of the integration
"visibility": "string" // visibility of the integration (e.g.public, private)
}
"workspace": {
"id": "string", // unique identifier for the workspace
"name": "string", // name of the workspace
"visibility": "string" // visibility of the workspace (e.g.public, private)
},
}

Here's an example of a Circuit Context Object to illustrate its structure and data. Specifics are included in the following format within the content of a running execution.

"portal": {
       "id": "OnboardXV",
"name": "OnboardPro"
},
"requestor": {
"id": "requestor456",
"name": "John Doe",
"email": "johndoe@example.com",
  "first_name": "John",
"last_name": "Doe",
  "contact_mobile": "+1234567890",
"timezone": "America/New York"
},
"workspace": {
   "id": "workspace789",
"name": "My Workspace",
  "visibility": "private"
},
"circuit": {
  "id": "circuit123",
  "name": "My Circuit"
},
"execution": {
  "id": "execution456",
"name": "My Execution",
  "description": "Sample execution",
  "parent_execution": {
"start_time": "2023-09-19T16:13:49.357Z",
"origin": "Orchestly",
"name": "7",
"id": "9bdf89f2-f7a0-4329-b63d-e2ab53f20f8d",
  "type": "test_run"
},
"type": "api",
"origin": "My Service",
"start_time": "2023-05-15T09:00:00Z",
"meta": {}
},
"current_state": {
"name": "State1",
"type": "function",
"start_time": "2023-05-15T09:05:00Z"
},
"integration": {
   "id": "integration789",
"name": "My Integration",
  "service": "My Service",
"service_id": "service123",
"visibility": "public"
}  


Suppose you want to access the execution ID, name, and start time in a state named "My Function State". You can achieve this using the following configuration:

{
"My Function State": {
"start": true,
"type": "function",
"function_id": "hello_world",
"parameters": {
"circuit_id": "$$.circuit.id",
"execution_id": "$$.execution.id",
"execution_name": "$$.execution.name",
"execution_start_time": "$$.execution.start_time"
},
"result_path": "$.result",
"next": "End"
}
}







    • Related Articles

    • Parameters

      Parameters provide the ability to customize JSON input by adding a collection of key-value pairs as input to a task. These values can either be static or dynamically selected from the JSON input or the context object using specific paths. Context ...
    • JSON Path

      Path serves to locate specific parts or components within a JSON object. These paths start with the '$' symbol and follow JSONPath syntax. It is used to access particular elements or values within JSON objects passed in the Input Path, Output Path, ...
    • Output Path

      Output Path enables you to select a portion of the state's output and transfer it to the next state for processing, eliminating any unecessary objects from the JSON output. If the Output Path isn't specified, the entire JSON node (determined by the ...
    • Result Selector and Result Path

      Result Path and Result Selector are employed to extract dynamic data from the state's result when the execution is successful. Result Selector Result Selector lets you retrieve and process the runtime data, enabling flexible and dynamic data ...
    • Sample Use Case - Configuring Input and Output Processing in Circuit console

      Let's explore Input/Output Processing further by building a Circuit using the example of an Employee Onboarding Process. We initiate the process with the following state Input which contains information about the employee details for employee ...

    You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.