- 22 Jun 2022
-
DarkLight
-
PDF
Pass Data Between Gen 2 Tasks
- Updated on 22 Jun 2022
-
DarkLight
-
PDF
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.
-
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.
-
Click on the transition line between the FetchFact and End nodes.
Figure 1: Insert Node
- Select "Insert Node" from the context menu.
- Another "New Node" will appear in line between the two existing nodes.
- Click the New Node to bring it into focus.
- In the Task Menu Sidebar, search for the "WorkflowEngine" Query task.
- Click the Query task to replace the New Node.
- 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
Configure the Query Task
Next, let's configure the variable information.
-
If not already selected, click the Query task on the canvas to view the details for the task in the right-side menu.
-
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.
-
Change the Description field to read "Just give me the fact".
-
Click the Variables tab.
-
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
-
Set the Value of the
query
variable tovalue.joke
.Figure 4: Query Value
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.
-
Change the
obj
Reference Task from "static" toFetchFact
and accept the defaultresponse
that displays. This indicates the data you want to search will be provided by the results of the FetchFact task. -
Click the Save button (disk icon) to save your work.
Figure 5: Query Object
Run the Automation
To test the workflow and see if it works:
- Click the blue Play icon (►) to the right of the Save icon on the canvas. A modal window will open.
- For now, ignore the entries for "Description" and "Groups".
- Click the START button. The Run Workflow modal opens and displays a message that the workflow has started.
- 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
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
{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.