Skip to content

Validating workflows and finding references

Workflows call actions, other workflows and configuration elements. Change one, and something else can break without telling you. Three buttons at the top of the workflow editor help: Validate looks for mistakes inside one workflow, Find usages lists everything that calls it, and Find dependencies lists everything it calls. Use the first before every run, and the other two before every change or delete.

Getting ready

  • The workflows from recipes 3.1 to 3.9, in VCF Orchestrator Guide/Chapter 3. The more of them you built, the more the usage lists show.
  • A minute to build a workflow with three mistakes in it.

How to do it

Let the editor find the mistakes

  1. Create a workflow called Describe a VM with mistakes in VCF Orchestrator Guide/Chapter 3, with an input vm (VC:VirtualMachine) and an output summary (string).
  2. Add a variable oldTimeout (number) and don’t use it anywhere. That’s mistake one.
  3. Add a scriptable task Describe it that reads vm and writes summary:
Describe a VM with mistakes — Describe it
summary = vm.name + ": " + vm.summary.config.numCpu + " vCPU";
  1. Drag a second scriptable task, Log the summary, onto an empty part of the canvas, give it an input summary but don’t bind it (mistake two), and draw an arrow from it to the end element. Nothing leads to it (mistake three).
  2. Click Validate at the top of the editor. A table opens below the canvas with one row per issue: Severity, Object, Message and Details. A warning icon also appears on the element at fault.
Schema tab of Describe a VM with mistakes: Describe it leads to End; Log the summary, with a warning icon, also leads to End but nothing leads to it. Below the canvas, the validation table: Log the summary, Input parameter 'summary' not set, Input binding parameter not set; Log the summary, Item 'Log the summary' unreachable, This item will never be called; oldTimeout, Workflow parameter 'oldTimeout' is never used, Workflow parameter is never used in any tasks nor decisions. 1 - 3 of 3 issues.
Figure 3.33. Validate lists three issues: an unbound input, an unreachable element and an unused variable.
  1. Fix them: delete oldTimeout, delete Log the summary or connect it after Describe it and bind its input. Click Validate again until the table is empty.
  2. Click Save. If anything is still wrong, the editor asks Validation is not successful. Are you sure you want to continue? View details shows the same table; Continue anyway saves regardless.

See what calls a workflow

  1. Open Describe a VM, the workflow from recipe 3.1 that later recipes reuse, and click Find usages.
Dialog Usages of Describe a VM with columns Name, Type and Location: Describe VMs in parallel, Workflow, Attribute: describeWorkflow; Describe a running VM, Workflow, Workflow Schema: item4; Describe several VMs, Workflow Schema: item1; Start a VM description, Workflow Schema: item2; Describe two VMs at once, Workflow, Multiple references (expandable); Describe a VM, Task, Attribute; Describe a VM later, Workflow Schema: item2; Approve a VM description, Workflow Schema: item6. 1 - 8 of 8.
Figure 3.34. Find usages of Describe a VM: every workflow, variable and scheduled task that refers to it.

The Location column says where the reference is: an element of the schema (Workflow Schema : item4), a variable (Attribute : describeWorkflow), or several places at once (Multiple references, expand the row to see them). Scheduled tasks count too: the row of type Task is the run that Describe a VM later scheduled in the schema element reference.

See what a workflow calls

  1. Open Describe a running VM (from the schema element reference) and click Find dependencies. It lists the action getVmFacts and the workflow Describe a VM, each with the element that uses it.
Dialog Dependencies of Describe a running VM with columns Name, Type and Location: getVmFacts, Action, Workflow Schema: item1; Describe a VM, Workflow, Workflow Schema: item4. 1 - 2 of 2.
Figure 3.35. Find dependencies of Describe a running VM: one action and one workflow.

How it works

Validate reads the workflow’s schema without running it. It reports elements that no path reaches, element inputs left unbound, variables and parameters nobody uses, and similar wiring problems. It can’t see inside scripts: a typo in a variable name or a call to a method that doesn’t exist only shows up when the script runs. For those, run the workflow, or check the script against the API reference before you save it.

The 9.1.1 validator marks most problems as warnings, not errors, which is why Continue anyway is offered. Treat every warning as a bug until you’ve read it.

Find usages and Find dependencies search the server’s content for references: in schema elements, in variables of type Workflow or Action, in scheduled tasks, and in scripts. A script that calls an action as System.getModule("com.vcfguide.chapter3").findVmsByName(...) is listed with the element and the line number (figure 4.5 in Chapter 4). What they can’t follow is a reference built while the script runs, such as a module name put together from variables, or a workflow ID read from a configuration element. So before you delete something, also search your scripts and configuration elements for its ID and name, for example in a package export (chapter 6).

Back in vRO 5.5–7Right-click an object in the Java client and choose Find Elements that Use this Element or References; validation ran from the Validate button in the workflow editor.
In Orchestrator 9.xThe same checks are buttons at the top of the workflow editor: Validate, Find usages and Find dependencies. Saving also validates.

There's more

Actions have two of the three. An action’s editor has Find usages and Find dependencies, but no Validate. Find usages is the quickest way to see which workflows break when you change an action’s inputs, including the scripts that call it.

Before you delete. Run Find usages, fix or remove each caller, then delete. A deleted workflow goes to Deleted Items, where you can restore it if you were wrong.

Keep the example. Describe a VM with mistakes is useful for showing a colleague what validation looks like. Don’t run it; its description says so.

See also