Result Path and Result Selector in State Processing | Online Help | Qntrl | Circuit

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 manipulation within your application. With this, you can precisely control the relevant and essential parts of the state's result, excluding unnecessary data or modifying existing values as needed.

To implement the desired modifications, you define key-value pairs where each key represents a specific result modification. The corresponding values associated with these keys can be either static or dynamically derived from the state's result. By using the Result Selector, you can tailor the data to be sent to the Result Path based on your specific needs.

Consider the following JSON data received as an output of a task or function execution in a state: 
{
      "status": "success",
      "message": "Employee onboarded successfully.",
      "emp_id": "543",
      "name": "Martin",
      "department": "Product Management",
      "joining_date": "2023-07-23",
      "designation": "PM Associate",
      "manager": "Jane Smith",
      "location": "New York",
      "salary": 75000,
      "benefits": [
            "Health Insurance",
            "401(k) Plan",
            "Paid Time Off"
      ],
      "documents": {
            "offer_letter": "offer_letter_EMP12345.pdf",
            "employment_contract": "empcontract_EMP12345.pdf",
            "tax_forms": "tax_forms_EMP543.pdf"
      }
}

Suppose, the 'employee_department' and 'offer_letter' alone in this result is expected in the next state, here's how it can be achieved using the Result Selector in code view:

{
      "get_employee_details": {
            "type": "circuit",
            "next": "End",
            "start": true,
            "circuit_id": "<Circuit_Name>",
            "result_path": "$.Output",
            "result_selector": {
                  "employee_department": "$.department",
                  "letter_of_intent": "$.documents.offer_letter"
            }
      }
}
The given definition of the Result Selector produces the following output:
"output": {
      "employee_department": "Product Management",
      "letter_of_intent": "offer_letter_EMP543.pdf"
}

Only the necessary information is extracted from the result and passed as output.

For configuring JSON Path expressions in the Result Selector, refer to the Context Object.

Result Path 

Result Path enables you to adjust the output of a state. Within the Result Path, you can specify the state's input, the state's result, or a combination of both as the state's output. Essentially, you have the option to append the state's result to the JSON input given to the state and make alterations. You can then pass this modified JSON as the state's output to the next state for processing. It's important to note that if the Result Selector is configured, Result Path becomes mandatory.

 

Result Path is available for all the states except Branch, Wait, Success, and Failure.

If the Result Path is not specified, the state will discard the result and retain the original input.
For example, let the following JSON be the state input for your execution: 
{
      "org_name": "Global Solutions",
            "employee_details": {
            "name": "Martin",
            "emp_id": "543",
            "role": "PM Associate"
      }
}

Let the state result received be the following:

"location": "New York"

To keep the state input intact and to append the state result to it, set result_path to $.location:

{
      "get_employee_details": {
            "type": "pass",
            "next": "End",
            "start": true,
            "result_path": "$.employee_details.location",
            "result": "New York"
      }
}

This includes the state result with the actual input:
{
      "org_name": "Global Solutions",
            "employee_details": {
            "name": "Martin",
            "emp_id": "543",
            "role": "PM Associate",
            "location": "New York"
      }
}
In the event of a failed execution, the data can be refined utilizing Error Path and Error Selector.




    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION









                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Error selector and Error path

                                                                                                                Error Selector and Error Path are used to manage errors in a system. While Result Selector and Result Path control the output of a state upon successful execution, Error Selector and Error Path come into play when the are exceptional circumstances, ...
                                                                                                              • 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 ...
                                                                                                              • 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 ...
                                                                                                              • 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, ...
                                                                                                              • Advanced Fields

                                                                                                                Lookups Lookups are fields used to obtain a subset of options from available values in fields, tables, webhook API responses, or database query responses. Existing data available in the organization can be reused using lookups. Lookups usually return ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources