Pass Data Between Gen 2 Tasks
  • 22 Jun 2022
  • Dark
    Light
  • PDF

Pass Data Between Gen 2 Tasks

  • Dark
    Light
  • PDF

Article Summary

Passing Data Between Tasks

In this section you will add another task to your automation and pass variable data to it.

Prepare the Canvas

Let's prepare the Gen 2 workflow canvas by adding another task.

  1. Go back to the Automation Studio tab.

    • If you closed the application tab, simply go to the IAP home screen and click the "Automation Studio" option in the left navigation menu.
    • Select Find an Automation and search for the "EnlightenMe" automation you created previously.
  2. Click on the transition line between the FetchFact and End nodes.

    Figure 1: Insert Node

01_GEN2-AddNode

  1. Select "Insert Node" from the context menu.
  2. Another "New Node" will appear in line between the two existing nodes.
  3. Click the New Node to bring it into focus.
  4. In the Task Menu Sidebar, search for the "WorkflowEngine" Query task.
  5. Click the Query task to replace the New Node.
  6. Click the Save icon (left side of canvas) to save your work.

You should now have four different (yet connected) tasks on your canvas:

  • START
  • FetchFact
  • Query
  • END

Figure 2: Add Query Task

02_GEN2-Query

Configure the Query Task

Next, let's configure the variable information.

  1. If not already selected, click the Query task on the canvas to view the details for the task in the right-side menu.

  2. From the Details tab, change the value in the Summary field from Query Data Using 'json-query' Format to IsolateFact. This will help us distinquish this restCall task from others later on.

  3. Change the Description field to read "Just give me the fact".

  4. Click the Variables tab.

  5. For this example, set the Value of the pass_on_null variable using the slider button to "False" (the slider will be in the left position). This tells the automation to "fail" the task in Jobs (Operations Manager) if no value is provided.

    Figure 3: Pass_on_null

03_GEN2-Pass_on_null

  1. Set the Value of the query variable to value.joke.

    Figure 4: Query Value

04_GEN2-QueryValue

You're probably asking where did value.joke come from? To see the origin, go back to the Jobs (Operations Manager) tab you left open. Refer to the response variable in the OUTGOING tab of the Task History. The response was provided in the form of a JSON object.

In the JSONPath syntax of the `response`, find where `value.joke` exists as a key-value pair.

**Note:** For more information on JSONPath syntax, we recommend reading [JSONPath-XPath for JSON](https://goessner.net/articles/JsonPath/). We also recommend the [JSONPath Online Evaluator](https://jsonpath.com/) when experimenting with JSONPath data extraction.
  1. Change the obj Reference Task from "static" to FetchFact and accept the default response that displays. This indicates the data you want to search will be provided by the results of the FetchFact task.

  2. Click the Save button (disk icon) to save your work.

    Figure 5: Query Object

05_GEN2-QueryObject

Run the Automation

To test the workflow and see if it works:

  1. Click the blue Play icon (►) to the right of the Save icon on the canvas. A modal window will open.
  2. For now, ignore the entries for "Description" and "Groups".
  3. Click the START button. The Run Workflow modal opens and displays a message that the workflow has started.
  4. Within the modal, click the View Job button. A new tab opens in your browser to display the Job Details (within Operations Manager) of the running job you just started.

Figure 6: Job Details

06-GEN2-JobDetails-21.2

Viewing the Job

In the newly opened Jobs (Operations Manager) tab, take a moment to study the page to see the different types of information that's available in this view. This time, two tasks are displayed:

  • IsolateFact
  • FetchFact

Click the view icon at the end of the IsolateFact task. The Outgoing tab in the Task History reveals the value of the return_data variable, indicating that you successfully isolated the incoming fact from the data that was returned by the Query task.

Figure 7: Outgoing Task Data

07-GEN2-OutgoingTaskData-21.2{height="" width=""})

Summary Wrap-Up

Congratulations on completing this segment of the tour! By now, you should know how to:

  • Build an automation.
  • Pass variable data between tasks in an automation.
  • Use the Query task.

In the next section, you will learn how to customize the input values.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.