List Workspaces

Definition

The "List Workspaces" action retrieves a complete list of all workspaces and organizations that the authenticated user is a member of within Asana. This action serves as a foundational step for many automations, allowing you to dynamically target specific areas within your Asana account for subsequent tasks like creating projects or tasks.

Key capabilities:

  • Retrieves all accessible workspaces and organizations.
  • Provides key details for each workspace, including its unique ID, name, and type.
  • Identifies whether a workspace is an organization, which represents a larger company structure.

This action is essential for building dynamic and scalable workflows, as it enables other actions to operate within the correct Asana environment without requiring hardcoded IDs.


Inputs

  1. Connection This field is used to establish a secure, authenticated connection to your Asana account. You must select a pre-configured Asana connection or create a new one to authorize zenphi to access your workspace data.

Outputs

  1. items This output is a list of all the workspaces and organizations accessible to the user. Each item in the list is an object containing the following properties:
  • Id: The unique numerical identifier for the workspace.
  • Name: The name of the workspace as it appears in Asana.
  • Type: The type of the workspace, such as "workspace" or "organization".
  • Is Organization: A true/false value indicating whether the workspace is an organization. An organization is a special type of workspace that represents a company and allows for more advanced member management.

Example Use Cases

  1. Dynamically Create Projects Retrieve a list of all available workspaces to allow users to select the correct one before creating a new project.
  2. Route Tasks Intelligently Fetch workspaces to build logic that routes incoming tasks or requests to the appropriate team based on the workspace name.
  3. Audit User Access List all workspaces and organizations to perform a security audit, ensuring the user account has access to only the intended environments.
  4. Populate User-Facing Forms Use the output to dynamically populate a dropdown menu in a zenphi Form, providing users with an up-to-date list of workspaces to choose from.

Example

Scenario: An IT department uses a zenphi Form for employees to request new projects. To ensure the project is created in the correct Asana environment (e.g., "Marketing," "Engineering," "HR"), the workflow needs to dynamically fetch all available workspaces and then create the project in the one specified in the form submission.

Steps to Implement:

  1. Create a Trigger: Start the Flow with a zenphi Form Trigger. Include a text field where the user can enter the exact name of the desired Asana workspace (e.g., "Marketing Department").
  2. Configure the "List Workspaces" Action:
  • Add the Asana "List Workspaces" action immediately after the trigger.
    • Connection: Select your pre-configured Asana connection.
  1. Find the Correct Workspace: Add a "Find Item in Collection" action to search the output of the previous step.
    • Collection: Use the token picker to select the items output from the "List Workspaces" action.
    • Condition: Configure the condition to find an item where the Name property is equal to the workspace name provided in the form submission.
  1. Create the Project: Add an Asana "Create Project" action.
    • Workspace Id: Use the token picker to insert the Id of the found item from the "Find Item in Collection" action.
    • Project Name: Use the token picker to insert the project name from the form submission.

Outcome: The workflow is now fully automated and dynamic. It eliminates the need to hardcode workspace IDs, reducing the risk of errors if a workspace is renamed or deleted. Employees can submit requests through a simple form, and the project is automatically created in the correct Asana workspace, improving efficiency and ensuring organizational consistency.


Best Practices

  1. Cache Workspace Data: If your list of workspaces does not change frequently, consider storing the output in a zenphi Table or Google Sheet. This allows subsequent Flows to read from the cache instead of making an API call every time, improving performance and conserving API limits.
  2. Handle No Results: Implement error handling or conditional logic to manage scenarios where the action returns an empty list. Your workflow should gracefully handle cases where the user may not have access to any workspaces.
  3. Distinguish Organizations from Workspaces: Use the Is Organization boolean output to differentiate between standard workspaces and larger organizations. This is critical for workflows that involve member management or permissions, as organizations have different administrative features.
  4. Use Descriptive Naming in Asana: Encourage clear and consistent naming conventions for workspaces within your Asana account. This makes it easier to identify and select the correct workspace dynamically within your zenphi Flows, especially when using search or filter logic.