Sample use case for I/O Processing | Optimizing I/O Processing in Employee Onboarding Circuit | Online Help | Circuit

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 onboarding:

{
"employee_details": {
"emp_name": "John Doe",
"emp_id": "357",
"department": "Engineering",
"role": "Software Engineer"
},
"onboarding": {
"phase": "Employee Onboarding",
"start_date": "2023-08-01",
"manager": "Jane Smith",
"location": "NewYork"
}
}

Now, let's define Input & Output Processing fields (in Code view) for the above process:

{
"onboard_employee": {
"type": "function",
"next": "End",
"start": true,
"function_id": "function_emp_onboard_1",
"parameters": {
"name": "$.employee_details.emp_name",
"ID": "$.employee_details.emp_id",
"department": "$.employee_details.department"
},
"input_path": "$.employee_details",
"result_selector": {
"task_status": "$.SdkResponseMetadata.HttpStatusCode"
},
"result_path": "$.onboarding_result",
"on_error": [
{
"error_type": "timeout_error",
"fallback": {
"next": "End",
"error_path": "$.error",
"error_selector": {
"error_code": "EXC_TME_EXC",
"error_message": "Execution Time Limit Exceeded"
}
}
}
],
"output_path": "$.employee_details"
}
}

 

The below images illustrate how the I/O processing fields are configured for the above example in both Builder View and Code View.

Builder View


 

Code View



In this setup:
  • Input Path: Initially filters the JSON to retain only the $.employee_info object, focusing on employee details.
  • Parameters: Passes specific employee-related data (employee_id, employee_name, department, role) to the onboarding function.
  • Result Selector: Extracts the HTTP status code from the response of the Function state, providing insights into the success or failure of the onboarding process.
  • Result Path: Appends the onboarding result as a child of the employee_info node in the original input JSON ($.onboarding_result).
  • Error Selector and Error Path: Capture and store error details in case of any issues during the onboarding process.
  • Output Path: Specifies that the final result passed to the next state is $.employee_info, ensuring only relevant employee information is carried forward.
After processing, the resulting JSON output for the next state will appear as follows:

{
      "role": "Software Engineer",
      "emp_name": "John Doe",
      "department": "Engineering",
      "emp_id": "357"
}


In case of a timeout error during execution, the output JSON will be:

{
  "error_code": "EXC_TME_EXC",
"error_message": "Execution Time Limit Exceeded"
}

This demonstrates how the Input Path, Result Selector, Result Path, and Output Path can be effectively utilized in the context of Employee Onboarding, ensuring that only relevant data progresses to subsequent states in the Circuit.




    • Related Articles

    • Circuit

      Circuit enables you to create automated workflows for IT and business by organizing a sequence of tasks. In certain cases, a process might include complex sub-processes that can be constructed as separate standalone circuits. These circuits can be ...
    • Sample Use Cases

      Payment process In a typical payment process, for every purchase made, a payment link with the invoice will be shared with the purchaser. Upon successful payment, a receipt will be generated; in the event of failure, the entire process will have to ...
    • Create and Configure a Circuit

      Create a Circuit Log in to Qntrl. Click Circuit from the left pane, then click New Circuit. Specify a unique Name and add a Description for the Circuit. Click Save. A sample circuit with the Pass state and name as 'State1' will be created by default, ...
    • Configuring Additional Components

      Webhooks Create a Webhook To create a new Webhook: Click Webhook in the left pane and click New Webhook. Fill in the following details: Type: Select Standalone (the only supported type for Circuit). Name: Enter a name for the webhook. URL: Specify ...
    • Input Path

      Input Path enables you to filter and control the actual input passed to the state. By defining an Input Path (either in Builder View or Code View), using JSONPath notation, you can select a portion of the JSON input and use it for processing within ...

    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.