Using nested loops

You can create loops within loops (nested loops) to build complex workflows, with no limit on the number of loops you can add.

About this task

Create a workflow that fetches all cards from a specific Trello board, creates a new note for each card in a specific Evernote notebook, and posts the details of the note to a specific space in Cisco Webex Teams. This process requires two levels of loops.

Procedure

  1. Drag the Trello - Get Board Cards action on canvas and configure it.
  2. Add the Loop action to the canvas, connect it with the Trello - Get Board Cards action, and configure it.
  3. Hover over the Loop action icon and click the Settings icon to open the Loop action configuration window.
  4. Set the Select Loop Type field to Each Item and add the Cards key that is listed in the output of the Trello - Get Board Cards action in the Source Array/Object field.
  5. Click Next, test the action, and go back to the canvas.
    You can now start adding other actions inside the loop.
  6. To add actions to the loop, double-click the Loop icon. You are redirected to the Loop canvas within the original canvas. Here, you can add actions that you want to run inside the loop. To create a note for each Trello card in Evernote, add the Evernote - Create Note and Loop actions to the canvas, and connect them to the loop start and loop stop icons.
  7. Add the name key listed under the Loop - currentItem key in the Title key and desc key in the Body key. Specify the notebook in which you want to create notes in the Notebook ID field.
  8. Click Next, test the action, and go back to the loop canvas. Next, hover over the Loop action icon and click the Settings icon to open the Loop configuration window.
  9. Set the Select Loop Type to Times and enter 1 in the Number of Times field. Click Next, test the action, and go back to the loop canvas.
  10. To add actions to Loop - Level 2, double-click the Loop action to open the Loop-Level 2 canvas. By clicking the relevant breadcrumbs link, you can toggle between different loop levels. You can now add actions to the Loop - Level 2 canvas.

    For this example, to post the details of the created note to a specific Cisco Webex Teams space, add the Cisco Webex Teams - Post New Message action to the canvas and connect it to the Loop Start and Loop Stop icons.

    Configure the Cisco Webex Teams - Post New Message action. Specify the space on which you want to post the message in the Space ID field. Add the title and content keys that are listed under the Evernote - Create Note action in the Message field.

  11. Click Next, test the action, and return to the Loop - Level 2 canvas. After the workflow is configured, click the Close icon to go back to the main workflow. Save and run the workflow.
    It fetches all the cards from the specified Trello list, creates a note for each card in Evernote, and posts the note details to the designated Cisco Webex Teams space.

What to do next

This example demonstrates how to use nested loops to create a complex workflow. You can add other loop levels as needed to create more advanced workflows.