Lesson 2: Use Variables and Test Workflows

Now that you’ve learned the basics of how workflows run, complete this lesson to learn how to add data for the workflow to process. We’ll also show you how to test your workflow.

This lesson usually takes ten minutes or less to complete.

To add input variables to the trigger and test the workflow:

  1. Click on the Workflows section of the side navigation.
  2. Click on the three dots on the right side of the “Welcome Workflow” card and click on the Edit in Builder option. This will open the Workflow Builder.
  3. To edit the trigger, click on the trigger icon on your workflow canvas to open the trigger configuration panel.
  4. Click + Add Variable in the Input section. Name this variable firstname and select String for the variable data type.
  5. Click + Add Variable again to add a second one. Name this variable lastname and select String again.
  6. Click the Continue button. You’ll see information on API keys and cURLs --we’ll cover what these do in a future lesson.
  7. Click the Close button.
  8. Click on the trigger icon on your workflow canvas to open the trigger configuration panel and edit the trigger. In the configuration panel, delete the exclamation point after Welcome to InsightConnect in the “Output Format” field. Replace the exclamation point with a comma and a space, then click on the blue + icon in the bottom right.
  9. Select Welcome Trigger.firstname, then type a space, then click on the blue + icon again and select Welcome Trigger.lastname. Add an exclamation point after “{{[Welcome].[lastname]}}”.
  10. Click Preview. Don’t worry about the way the artifact preview looks for now. In this example, it should look just like the content in the “Output Format” field you just configured.
  11. Click Add Artifact.
  12. Click on the grey Test button in the top-right of the Workflow Builder. Type your own first and last names into the provided fields, then click the Test Workflow button. A version of the “Job Details” page will appear in a few seconds.
  13. Click on the Artifacts tab and take a look at the content in the artifact.
  14. Your steps will save automatically as Unpublished Changes.

Congratulations! You added variables to a workflow and learned how to use them in following steps. You also learned how to test workflows and check that the workflow runs as expected.

In this lesson, you added data to your workflow. Variables are responsible for passing the data through your workflow. When you added variables to the trigger, you provided data for the artifact step to process. In the workflow, you created two string type variables. Strings are the easiest ways to create messages in artifacts. Strings can include letters, numbers, characters, variables, and more.

When you modified the artifact’s “Output Format,” you used variables from the trigger in the artifact’s message. The + sign in the “Output Format** field lets you easily see what variables are available for use in the current step -- they are sorted based on the step that created the variable.

This time, instead of activating the workflow and running it from the "Workflows” page, you tested the workflow from the Workflow Builder without publishing the changes. Unpublished changes allow you to edit and test the workflow, without affecting the active version of that workflow. Testing lets you safely see what a workflow will do with different inputs, so you can make changes to your workflow as needed.

InsightConnect automatically took in the information that you provided for the ‘firstname’ and ‘lastname’ variables to create your artifact. Try testing the workflow again with different first and last names to see how the artifact changes based on the data you provided.

In the next lesson, you’ll learn how to use action steps and plugins.