Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

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:

  1. Input Path: Initially filters the JSON to retain only the $.employee_info object, focusing on employee details.

  1. Parameters: Passes specific employee-related data (employee_id, employee_name, department, role) to the onboarding function.

  1. 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.

  1. Result Path: Appends the onboarding result as a child of the employee_info node in the original input JSON ($.onboarding_result).

  1. Error Selector and Error Path: Capture and store error details in case of any issues during the onboarding process.

  1. 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 would look like this:
{
      "role": "Software Engineer",
      "emp_name": "John Doe",
      "department": "Engineering",
      "emp_id": "357"
}

In case of a timeout error during execution, the output JSON would 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.


Helpful?00
Updated: 8 months ago
Share :
Follow

Subscribe to receive notifications from this article.

On this page