The Workflows connector defines the built-in
functions that can be used to access other Google Cloud products within a
workflow.

This page provides an overview of the individual connector.
There is no need to import or load connector libraries in a workflow---connectors
work out of the box when used in a call step.

## Workflow Executions API

Execute workflows created with Workflows API.
To learn more, see the [Workflow Executions API documentation](https://cloud.google.com/workflows).

> [!NOTE]
> **Note:** Ensure that the service account executing the workflow has the necessary Identity and Access Management (IAM) permissions to invoke another workflow. For more information, see [Invoke Workflows](https://docs.cloud.google.com/workflows/docs/use-iam-for-access#invoke-workflows).

## Helper method

You can use the helper method `run` to launch a workflow execution. This is
simpler than using the `create` API as it doesn't require workflow arguments in
a JSON string format.
To learn more, see the [run documentation](https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/run).

## Workflow Executions connector sample

### YAML

    # This workflow demonstrates how to use the Cloud Workflow Executions connector
    # to create an execution for a workflow. Make sure the workflow
    # already exists in your project.
    # Expected successful output: "SUCCESS"

    - init:
        assign:
          - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          - location: "us-central1"
          - workflow: "[fill in the workflow to execute]"  # Make sure this workflow exists in your project.
          - arguments:
              hello: world
              integer: 100
              boolean: true
    # The run helper method is the preferred way to execute a workflow as it doesn't require
    # encoding the workflow arguments in a JSON-formatted string. To compare
    # the usage, we list two demo steps:
    - run_execution:
        call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run
        args:
          workflow_id: ${workflow}
          location: ${location}
          project_id: ${project}
          argument: ${arguments}  # Arguments could be specified inline as a map instead.
        result: r1
    - create_execution:
        call: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.create
        args:
          parent: ${"projects/" + project + "/locations/" + location + "/workflows/" + workflow}
          body:
            argument: ${json.encode_to_string(arguments)}
        result: r2
    - the_end:
        return:
          - ${r1}
          - ${r2}

### JSON

    [
      {
        "init": {
          "assign": [
            {
              "project": "${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}"
            },
            {
              "location": "us-central1"
            },
            {
              "workflow": "[fill in the workflow to execute]"
            },
            {
              "arguments": {
                "hello": "world",
                "integer": 100,
                "boolean": true
              }
            }
          ]
        }
      },
      {
        "run_execution": {
          "call": "googleapis.workflowexecutions.v1.projects.locations.workflows.executions.run",
          "args": {
            "workflow_id": "${workflow}",
            "location": "${location}",
            "project_id": "${project}",
            "argument": "${arguments}"
          },
          "result": "r1"
        }
      },
      {
        "create_execution": {
          "call": "googleapis.workflowexecutions.v1.projects.locations.workflows.executions.create",
          "args": {
            "parent": "${\"projects/\" + project + \"/locations/\" + location + \"/workflows/\" + workflow}",
            "body": {
              "argument": "${json.encode_to_string(arguments)}"
            }
          },
          "result": "r2"
        }
      },
      {
        "the_end": {
          "return": [
            "${r1}",
            "${r2}"
          ]
        }
      }
    ]

## Module: googleapis.workflowexecutions.v1.projects.locations.workflows

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows/triggerPubsubExecution` | Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification. |

## Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/cancel` | Cancels an execution of the given name. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/create` | Creates a new execution using the latest revision of the given workflow. Input parameters must be represented as a JSON string. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/deleteExecutionHistory` | Deletes all step entries for an execution. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/exportData` | Returns all metadata stored about an execution, excluding most data that is already accessible using other API methods. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/get` | Returns an execution of the given name. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/list` | Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first). |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions/run` | Starts a workflow execution and waits for it to finish. This provides a simpler interface to launch a workflow execution than the `create()` method. Note that `run()` calls `create()` to start a new execution, and optionally accepts execution parameters defined in the YAML source code as either integer, float, bool, string, list, or map data types. |

## Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.callbacks

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions.callbacks/list` | Returns a list of active callbacks that belong to the execution with the given name. The returned callbacks are ordered by callback ID. |

## Module: googleapis.workflowexecutions.v1.projects.locations.workflows.executions.stepEntries

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions.stepEntries/get` | Gets a step entry. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1/projects.locations.workflows.executions.stepEntries/list` | Lists step entries for the corresponding workflow execution. Returned entries are ordered by their create_time. |

## Module: googleapis.workflowexecutions.v1beta.projects.locations.workflows.executions

| Functions ||
|---|---|
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1beta/projects.locations.workflows.executions/cancel` | Cancels an execution of the given name. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1beta/projects.locations.workflows.executions/create` | Creates a new execution using the latest revision of the given workflow. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1beta/projects.locations.workflows.executions/get` | Returns an execution of the given name. |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1beta/projects.locations.workflows.executions/list` | Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first). |
| `https://docs.cloud.google.com/workflows/docs/reference/googleapis/workflowexecutions/v1beta/projects.locations.workflows.executions/run` | Starts a workflow execution and waits for it to finish. This provides a simpler interface to launch a workflow execution than the `create()` method. Note that `run()` calls `create()` to start a new execution, and optionally accepts execution parameters defined in the YAML source code as either integer, float, bool, string, list, or map data types. |